i've a jsp with two html:text elements namely Fromdate and To date. These are intended for user to input datetime values. Next to these text boxes, calendar images are placed. Upon clicking the image the javascript:CSS calendar utility is invoked and it returns the selected date and time which is inserted to these text boxes. Everything was fine, till I added an onchange javascript function to the second text box. This js function calls an ajax method to check whether these values exist in the database. It also checks whether the dates are in correct sequential order. If the JS function returns false, the JSP page should not be forwarded. The functions are returning proper values, but even if the js function return false, the record gets added.
The following is my code:
HTML Code:
<tr>
<td align="left" height="27"> From</td>
<td align="left"><html:text name="myvo" property="fromDate" size="18"/>
<a href="javascript:NewCssCal('fromDate','ddmmyyyy','dropdown',true)"><img src="img/cal.gif" width="16" height="16" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td align="left" height="27"> To</td>
<td align="left"><html:text name="myvo" property="toDate" size="18" onchange="return dutyChecker('No','msgarea','2')"/>
<a href="javascript:NewCssCal('toDate','ddmmyyyy','dropdown',true)"><img src="img/cal.gif" width="16" height="16" alt="Pick a date"></a>
</td>
</tr>
am i missing something here? Or should I change the "onchange" to someother?
Kindly help