HI,
I have a form and when i click on the submit button it should check the validity of the values entered in the form and either one of the following should happen
1) if the validation fails i want to show an warning/error message and do nothing more
2) If forms contains all valid data i want to invoke an xyz.asp program with out refreshing the current page and also want to pop up status window.
Does any one know how to do this using java script.
Here is the sample code(which is not working properly):
<form action=”xyz.asp” id=””frm1″” method=”POST” name=”frm1″ target=”nextpage”>
<input maxLength=”5″ name=”fquantity” size=5 value=”2″>
<input type=”submit” value=”Submit” name=”click here” onClick=”return validateForm(this);”>
</form>
function validateForm(form)
var quant = form.fquantity.value
if ( (isNaN(quant) == true || quant < 1 || quant > 10000))
alert(“Please enter the quantity”);
form.fquantity.focus();
return false;
}
else
{
window.open(“xyz.asp”, “nextpage”, “height=220,width=350,resizable=no,location=no…”);
return true;
}
}
I appreciate any help…
Thanks,