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.

form validation

Discussion in 'Software Development' started by DJ-TM, Sep 17, 2003.

Thread Status:
Not open for further replies.
  1. DJ-TM

    DJ-TM Thread Starter

    Jul 23, 2003
    ok i just need a little help with validating a select box on a form.

    Form information:

    Form name = raise
    Select box name = issue

    i have wrote this function

    <script type="javascript">
    function validate()
    if document.raise.issue[document.raise.issue.selectedindex].value ="0"
    alert("Please select an issue type from the drop down list")

    and i call it using <submit onclick="validate()">

    i think im nearly there but its not working, could anyone point me in the right direction.
  2. lora_3677


    Aug 4, 2003
    You really should add some variables, so later down the road you can reuse the script easily by just changing one line, instead of a bunch of code.... but... try this...

    if raise.issue.options[raise.issue.selectedIndex].value ="0"

    I had a program like this and I set up variables, like this:


    Then you can use it for the validation

    if stxtNumber == "0"
    alert... blah blah

    Try it...
  3. Mithrilhall


    Mar 28, 2001
    Have you tried calling it like so?

    <input name="button" type="button" onClick="validate();">
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/165413

  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