A
alec
Hello,
Below please find a very simple code: form (form1) checks if two fields (T1
and T2) have entries and then submits to another page (confirmation.asp) As
you can see validation is done on the client side.
How do I change this code below so that validation be done on the server side?
Since I am a new to JavaScript programming, could you please do all the
changes necessary.
Thank you.
<html>
<head>
<script>
function DoSubmit()
{
if (document.form1.T1.value=="")
{
window.alert("Please fill the field No. 1 ")
return false
}
if (document.form1.T2.value=="")
{
window.alert("Please fill the field No. 2")
return false
}
document.form1.target="_self"
document.form1.action="confirmation.asp"
document.form1.submit()
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Submit</title>
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--" name="form1">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="text" name="T1" size="20"></p>
<p><input type="text" name="T2" size="20"></p>
<p> </p>
<span style="cursor:hand" onclick="DoSubmit()">Submit</span>
</form>
</body>
</html>
Below please find a very simple code: form (form1) checks if two fields (T1
and T2) have entries and then submits to another page (confirmation.asp) As
you can see validation is done on the client side.
How do I change this code below so that validation be done on the server side?
Since I am a new to JavaScript programming, could you please do all the
changes necessary.
Thank you.
<html>
<head>
<script>
function DoSubmit()
{
if (document.form1.T1.value=="")
{
window.alert("Please fill the field No. 1 ")
return false
}
if (document.form1.T2.value=="")
{
window.alert("Please fill the field No. 2")
return false
}
document.form1.target="_self"
document.form1.action="confirmation.asp"
document.form1.submit()
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Submit</title>
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--" name="form1">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="text" name="T1" size="20"></p>
<p><input type="text" name="T2" size="20"></p>
<p> </p>
<span style="cursor:hand" onclick="DoSubmit()">Submit</span>
</form>
</body>
</html>