Forum Moderators: open
I am facing a problem with the javascript code that i have written...The code is pasted below..
The link in my jsp file is as below:
<a class="stdlink" href="javascript:downloadVolumeReport();"><img src="images/button_download.gif" alt="Download" border="0"></a>
------------------------------- Javascript Codes are as below
function downloadVolumeReport()
{
if ( doDateCheck() )
{
var frm_nm = document.volume_report ;
frm_nm.form_action.value="generate_volume_report" ;
frm_nm.action = "finance_rep" ;
frm_nm.method = "post";
frm_nm.submit();
}
else
{
return false;
}
}
------ The function doDateCheck is in other .js file....
function doDateCheck()
{
if ( Date.parse(document.volume_report.FromDate.value) > Date.parse(document.volume_report.ToDate.value) )
{
alert("To Date must be Later than From Date.!\n\n Please Select the date range again.");
document.volume_report.FromDate.focus();
return false;
}
return true;
}
----------------
Now the problem is that if I select the dates in the form such that the "FromDate" is Greater then the "ToDate" and click on submit then a blank page is displayed with false printed on it. But if i remove the false word then the blank page with teh false word is not dispalyed...
As far as i know if a javascript function validates the form data and finds a problem then to avoid displaying the next page we use "return false" statement......
But i am not able to understand why this is happening.....
Guyz...Please help me in resolving this as it is reallly hampering the progress of my work...
Thanks in advance