Data Access Page - Field won't update

  • Thread starter Thread starter Haplo567
  • Start date Start date
H

Haplo567

Guest
Here's the situation: We're using a DAP as a database front end. What I'm trying to do is have the user enter a phone number in text boxes, but output the result to one field. The way I'm doing this is by having a hidden text box bound to the phone number, and updating it via the onkeyup event for the three input text boxes. Here's the relevant code I'm using:

<SCRIPT language=vbscript>
<!--
Sub CompilePhone()
PhoneNumber.innerText = txtPhone1.innerText & txtPhone2.innerText & txtPhone3.innerText
End Sub

Sub UncompilePhone()
txtPhone1.innerText = left(PhoneNumber.innertext,3)
txtPhone2.innerText = mid(PhoneNumber.innertext,4,3)
txtPhone3.innerText = mid(PhoneNumber.innertext,7)
End Sub
-->
</SCRIPT>

<SCRIPT language=vbscript event=DataPageComplete(info) for=MSODSC>
<!--
call UncompilePhone()
-->
</SCRIPT>

<SCRIPT language=vbscript event=onkeyup for=txtPhone1>
<!--
Call CompilePhone()
-->
</SCRIPT>

<SCRIPT language=vbscript event=onkeyup for=txtPhone2>
<!--
Call CompilePhone()
-->
</SCRIPT>

<SCRIPT language=vbscript event=onkeyup for=txtPhone3>
<!--
Call CompilePhone()
-->
</SCRIPT>


The problem: This code works just fine, except for the fact that the data access page doesn't register that the phone number has changed when I change it via txtPhoneX. If I leave PhoneNumber unhidden and change it via txtPhoneX, I can then select PhoneNumber and enter a junk character and back space, then save it.

My question: Is there a way to force the phone number field to enter a state where it knows it needs to update?
 
...

you mean...?

isnumeric() so you know it is numeric.

or

len() = 10 so you know it's length.?

or both together?
 
Clarification

I'm not worried about validating the information entered in the field, I can do that easy enough.

My problem is that when I change the bound text box PhoneNumber via vbscript, the data access page doesn't understand that it's been changed and thus needs to update the corresponding field in the underlying table.
 

Users who are viewing this thread

Back
Top Bottom