PDA

Click to See Complete Forum and Search --> : refer to form.


Kagey
Sep 30th, 2000, 02:20 PM
in VBScript, how can i reference a form in the html page. What i am looking for is the equivalent to document.form.field1 in JavaScript.

Also, how do i detect the length of a field when the submit button is pressed, then display a message box depending on the length. thanks. I know how to do all of this in javascript, but i want to try it in vbscript.

Kagey

monte96
Sep 30th, 2000, 07:07 PM
The syntax is pretty much the same:


document.frmMyForm.txtTextBox


If your using Interdev, you will have Intellisense that help.. Also, you don't really need the document object to access the form, just the name of the form like:


frmMyForm.txtTextBox


For the length of the field:

<SCRIPT Language="VBScript">

Function frmMyForm_onsubmit
If Len(frmMyForm.txtTextBox.Value) > 10 Then
window.alert "Hey! That's too long!"
frmMyForm_onsubmit = False
End If

End Function

</SCRIPT>



[Edited by monte96 on 09-30-2000 at 08:16 PM]

Kagey
Sep 30th, 2000, 08:27 PM
Thanks a million dude. Slicker than a snot on a door knob.

itjacky
Oct 4th, 2000, 05:14 AM
In Javascript, We can use
Document.DirList.FileMenu.options[1].text="";
to modify the ListBox's field.


But how can I do that in VBScript ?
I try the same thing statement in VBScript but it said object '1' is needed.

Can any one help me ? Thank you!

monte96
Oct 4th, 2000, 10:01 AM
Well... you should probably have started a new thread for it.. but....


Document.DirList.FileMenu.options(1).innertext=""
Document.DirList.FileMenu.options(1).value=""


(I'm assuming you've declared your form's name to be DirList and your SELECT's name to be FileMenu.. if not.. all bets are off..)