Hi
I have written following function which checks whether start_date field is not empty and displays proper message when submit button is clicked. But then it takes the control to the previous page. So user has to write again all other fields on that form. Is there any way to stay on that page even after prompting the error message, with all other fields value.
function checkform()
{
if(document.frmMr.start_date.value == "")
{
alert("please enter start_date");
return false;
}
else
{
document.frmMr.submit();
}
}
<html>
<form name=frmMr action="page1.jsp" >
Enter Start date:
<input type="text" size="15" name="start_date" id="start_date">
<input type="submit" name="continue" value="submit" onClick="checkform();">
</form>
</html>
Thanks in advance