Hi ppl,
I have a form with a drop down box and a calendar picker.
I want to check if both these fields have been filled to proceed to the next page.
echo "<select name=Project value =' '>ProjectName</option>";
echo "<option>Select Project</option>";
while ($row=mysql_fetch_array($result)) {
echo "<OPTION VALUE=$row[Project_Id]>$row[ProjectName]</option>";
}
echo"</select>";
?></td>
<tr><td>Start Date:</td>
<td><?php
$myCalendar = new tc_calendar("date5", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2000, 2020);
$myCalendar->dateAllow('2008-05-13', '2010-03-01');
$myCalendar->setDateFormat('j F Y');
$myCalendar->writeScript();
?></td>
my javascript to select if the fields are selected is
function validateform(form1)
{
if(form1.Project.value.length==0)
{
alert('You have not selected any Project');
form1.focus();
return false;
}
else if(form1.date5.value.length==0)
{
alert('Select the Start Date');
form1.focus();
return false;
}
}
This code gives the message when the project field is not selected but not when the date is not selected.
HELP PLZ