Validating dynamic pull down menu forms.

Results 1 to 2 of 2

Thread: Validating dynamic pull down menu forms.

  1. #1
    Join Date
    Dec 1969

    Default Validating dynamic pull down menu forms.

    I have gone through the whole list, and can&#039;t seem to find the solution of a problem I have. Forgive me if I am repeating. Can someone please tell me how can I validate a pull-down menu submission.<BR><BR>I am using Lasso to extract data into a pull-down menu. The first option they see is ----Choose---- they choose a "County" name from the pull down menu. I want to display an alert message if they click on GO before choosing a "County". I am new to java-script, so please be easy on me.<BR><BR>I would be thankful for any help.<BR><BR>Sami

  2. #2
    Join Date
    Dec 1969

    Default Best place: and JS FAQ

    *Lots* of help there for validating forms, etc., etc.<BR><BR>But this one is pretty easy:<BR><BR>&#060;FORM ... onSubmit="return validate(this);"&#062;<BR>...<BR>&#060;SELECT Name="County" ...&#062;<BR>&#060;OPTION&#062;---choose a county---<BR>...<BR>&#060;/SELECT&#062;<BR>...<BR>&#060;/FORM&#062;<BR><BR>&#060;SCRIPT Language="JavaScript"&#062;<BR>function validate( frm )<BR>{<BR>&nbsp; &nbsp; if ( frm.County.selectedIndex == 0 )<BR>&nbsp; &nbsp; {<BR>&nbsp; &nbsp; &nbsp; &nbsp; alert("You must select a county!");<BR>&nbsp; &nbsp; &nbsp; &nbsp; frm.County.focus();<BR>&nbsp; &nbsp; &nbsp; &nbsp; return false;<BR>&nbsp; &nbsp; }<BR>&nbsp; &nbsp; ... do other validations ...<BR>&nbsp; &nbsp; return true; // only if everything validates okay<BR>}<BR>&#060;/SCRIPT&#062;<BR><BR>

Posting Permissions

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