NEED HELP IN FIXING A CODE

A

alec

Hello,
Below is the sample and simple code that checks the form before submission:
if week day is Sunday, nothing happens. On any other day form is submitted.
Question: this script works for client side validation. Could anybody please
show me what changes should be done in a code so that form would be checked
on the server side.
Thank you.

<html>

<head>
<script>
var today = new Date()
var weekdaynumber=today.getDay()
function DoSubmit()
{
if (weekdaynumber = 1)
{
window.alert("Today is Sunday")
}
else
{
window.open( "","new_window", "width=618, toolbar=0, menuebar=0, status=0,
height=700, scrollbars=1, resizable=0, top=0, left=0");
document.order_form.target="new_window";
document.order_form.action="confirmation_form.asp";
document.order_form.submit();
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<form method="POST" name="order_form">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="text" name="FirstName" size="20"></p>
<p><input type="text" name="LastName" size="20"></p>
<p> </p>
<span style="cursor:hand" onclick="DoSubmit()">Click here to submit</span>
</form>
</body>

</html>
 
R

Rad

I think this will make it works fine.

<html>

<head>
<script>
var today = new Date()
var weekdaynumber=today.getDay()
function DoSubmit()
{
if (weekdaynumber = 0)
{
window.alert("Today is Sunday")
}
else
{
window.open( "","new_window", "width=618, toolbar=0, menuebar=0, status=0,
height=700, scrollbars=1, resizable=0, top=0, left=0");
document.order_form.target="new_window";
document.order_form.action="confirmation_form.asp";
document.order_form.submit();
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<form method="POST" name="order_form" ID=Form1 action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="text" name="FirstName" size="20" ID=Text1></p>
<p><input type="text" name="LastName" size="20" ID=Text2></p>
<p><span style="cursor:hand" onclick="DoSubmit()">Click here to
submit</span></p>
</form>
</body>

</html>
 
K

Kevin Spencer

To do server-side validation, you would need to be using a server-side
application, such as ASP, PHP, or whatever is available on your server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top