-
How to not submit when checking a form
<html>
<head>
<title>formtest.htm</title>
<script language="javascript">
<!--
function submitform(){
if(document.thisform.txtname.value.length==0) {
alert("Please enter your name.");
return false;
}else{
return true;
}
}
//-->
</script>
</head>
<body>
<form name="thisform" method="post" action="formtest.htm" onSubmit="return
submitform();">
Enter your name: <input type="text" name="txtname" value="" size=20 maxlength=20><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
-
Re: How to not submit when checking a form
Form action should call any server side script/program like cgi,pl,dll,asp,
servlet .. etc. Note the changes in your code
JB Cox <jbcox@maxit-inc.com> wrote in message
news:3978bd48$1@news.devx.com...
>
> <html>
> <head>
> <title>formtest.htm</title>
> <script language="javascript">
> <!--
> function submitform(){
> if(document.thisform.txtname.value.length==0) {
> alert("Please enter your name.");
> return false;
> }else{
> return true;
> }
> }
>-->
</script>
> </head>
> <body>
>
<form name="thisform" method="post"
action="should be any server side script or program like cgi,pl,dll,asp
...etc"
onSubmit="return submitform();">
> Enter your name: <input type="text" name="txtname" value="" size=20
maxlength=20><br>
> <input type="submit" value="Submit">
> </form>
> </body>
> </html>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks