[thelist] custom javascript HELP!

Matthew Fischer mfischer at e-fishsolutions.com
Sun Nov 19 15:47:00 CST 2000


Use: 

     if (document.forms.validation.recipient.selectedIndex == 0)

Assumming that the first item in the list is the only one you want the alert on.

On 11/19/00 at 3:38 PM, bmonchka at hotmail.com (Barret A Monchka) wrote:

> Hello,  I want to create a javascript that will present an alert box if the 
> drop down menu (select) contains nothing ("").  I created the following 
> javascript, please let me know why it is not working.
> 
> <SCRIPT LANGUAGE="JavaScript">
> <!-- Begin
> 
> function emailselect() {
> 
> var selectemail = document.forms.validation.recipient.value;
> 
> if (selectemail == "")
>   {
>   alert("Please select a recipient.");
>   return false;
>   }
> else
>   {
>   return true;
>   }
> }
> 
> //  End -->
> </script>
> 
> Here is the html:
> 
>     <form name="validation" action="FormMail.pl" method="POST" 
> onSubmit="return (checkrequired(this) && checkbae() && emailselect());">
> 
> and also:
> 
> <select name="recipient">
> <option value="">-- Select --</option>
> <option value="one at one.com">one</option>
> <option value="two at two.com">two</option>
> <option value="three at three.com">three</option>
> </select>
> 
--

Matt Fischer || e-fish solutions, inc      (e)   \\\\\__   o  
   <mfischer at e-fishsolutions.com>           (e) /    o  \ o
  <http://www.e-fishsolutions.com>           (e)    ((  <
    877.WEB.FISH || 203.272.2987            (e) \+_+_+_/
           Fax 800.203.5816                (e)     \|/





More information about the thelist mailing list