1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VBScript

Discussion in 'Software Development' started by jwaldrich, Nov 12, 2001.

Thread Status:
Not open for further replies.
  1. jwaldrich

    jwaldrich Thread Starter

    Joined:
    Jun 28, 2000
    Messages:
    221
    During form validation in VBS, how do I return focus to txtGross after displaying the message?

    SCRIPT LANGUAGE="VBScript"

    function verify_form()

    if isNumeric(document.frmTax.txtGross.value) then
    verify_form = true
    else
    msgBox "Please enter a numeric number gross income figure:"
    document.frmTax.txtGross.set.focus
    verify_form = false
    end if

    if (document.frmTax.txtGross.value.len) < 1 then
    msgBox "Please enter a numeric gross income:"
    document.frmTax.txtGross.set.focus
    verify_form = false
    else
    verify_form = true
    end if
    End Function
    /script

    With the above code, I end up on my .asp page with an error message stating "type mismatch" (it sends an empty string and the .asp is expecting a numerical input).

    How do I display the message and then return the focus to txtGross?

    Thanks,
    John
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Try using = "" for a null value instead of <1. Don't know if that fits the value or not.
     
  3. jwaldrich

    jwaldrich Thread Starter

    Joined:
    Jun 28, 2000
    Messages:
    221
    What I finally ended up doing was using "if" statements and href on the ASP page but it works.

    Thanks for your quick response!

    Regards,

    John
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/58413

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice