Re: Javascript question

by Romek <zylla(at)ck-sg.p.lodz.pl>

 Date:  Thu, 13 Dec 2001 13:21:11 -0100
 To:  "cbirds(at)earthlink.net" <cbirds(at)earthlink.net>
 Cc:  hwg-techniques(at)hwg.org
 In-Reply-To:  mediaone
  todo: View Thread, Original
At 16:13 12-12-01 -0500, you wrote:
>
>I am using this code in a javascript to alert people about fields not 
>filled in a form.

>Ones that work on regular fields look like this:
>if (document.name.value == "") {correct = false; alert("Please enter your 
>name!")}
>
>Ones that do not work that way nor this way on popup menus:
>if (document.state.value == "choosestate") {correct = false; 
>alert("Please select your state!")}

 The problem maybe is in the form itself (not seeing your code)
 I assume it is like the list with names of the sate and first
  position is value="choosestate"
  Then you have add  "selected" to this item to make your script
  code work.

  Eventually you can modify your "if" statement:

  if ( document.state.value == "choosestate"
       || document.state.value == "" )
     { correct = false;  alert("Please select your state!")}

  Mind the additional condition for checking if the field is empty

>
>It also doesn't work if you just have the first bar blank....and code 
>accordingly.
>Any ideas?
>
>
>
--
Romek Zylla
~~~~~~~~~~~  after all the work done by Micro$oft (R)  ~~~~~~~~~~
        Personal Computer Science is an experimental one (C)
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA