form submit question

M

Matt

When the user click the submit button in myform.asp, then it will invoke the
javascript to check the form data. I want to know if we need
document.myform.submit(); ?? Because even I comment it out, formresponse.asp
could still get the form data.

//myform.asp
<html>
<head><title></title>
<script language="javascript">
function checkformdata()
{
//etc...
document.myform.submit();
}
</script>
</head>
<body>
<form action="formrespsonse.asp" name="myform" method="post"
onsubmit="checkformdata()">
//etc...
<P><input type="submit"><input type="reset">
</form>
</body>
</html>

//formresponse.asp
<%= Request.Form %>
 
R

Ray at

This is not an ASP question. This is a client-side scripting question, but
to answer your question, no, you don't need that .submit() stuff. Client
side validation is typically handled as such:

<form onsubmit="return yourFunction();">

<script type="text/javascript">
function yourFunction() {
if(your condition here) {
return true;
}
else {
return false;
}
}
</script>

Ray at home
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top