Hi,

I am very new to Java Script and currently working on a program. Basically i am developing a pharmaceutical website. I have a php form with a drop down menu. The user selects a drug from the drop down menu to prescribe, then submits it. However, i need to try and validate this form with Javascript, and this is where my problem lies. Because i have echo'd out the list of all the drug id's,name and dosage, i dont know how to then validate each variable.

<form name="myform" action="<?php echo $pfile;?>" method="post" >
<input type="hidden" name="patientid" value="<?php echo $patientid;?>" />

PHP Code:
    
    $sql    
'SELECT * FROM `Drug` ';
    
$result mysql_query($sql);
   
    if (
mysql_num_rows($result) == 0)
        echo 
" -- No patients found -- ";
    else {
        echo 
"<select name=\"drugid\">/n";
        echo 
"<option value=\"\"> </option>\n";
        while (
$r mysql_fetch_array($resultMYSQL_ASSOC))
            echo 
"<option value=\"" $r['ref'] . "\">" $r['ref'] . " : " $r['name'] . " " $r['dose'] . "</option>\n";
        
        echo 
"</select>\n";
    } 
<input type="submit" onclick="formvalidation('document.myform')" id="formbutton" value="Prescribe">

</form>

I then have tried to put Java Script into my header like so:

Code:
 <script>
	function formvalidation() {
    // Fetch email-value
  dose = document.myform.dose.value ;
    // value empty?
    if (dose == "10mg")
        {
            alert('That's a High Dosage');
            return false;
        }
   </script>

My JavaScript is just being ignored. Does anyone have any idea to validate for example, if the dose being submitted is 10mg, an alert will appear? Thanks in advance