Results 1 to 5 of 5

Thread: refer to form.

  1. #1

    Thread Starter
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294

    Smile

    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

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    The syntax is pretty much the same:

    Code:
        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:

    Code:
        frmMyForm.txtTextBox
    For the length of the field:
    Code:
    <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]
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294

    Thanks

    Thanks a million dude. Slicker than a snot on a door knob.

  4. #4
    New Member
    Join Date
    Oct 2000
    Posts
    11
    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!

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Well... you should probably have started a new thread for it.. but....

    Code:
    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..)

    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width