navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

submit problem

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> submit problem
Page: [1]
 
wizard_oz

 

Posts: 140
Joined: 9/3/2004
From: Ga,USA
Status: offline

 
submit problem - 2/11/2008 13:46:30   
Hi, I have a problem with checking some fields before click the SUBMIT button. I would like to check the fields and if the feilds are empty I would give a message that say "the feild is empty" and if not, continue to the next page
my code is simple and look like:
<form action="InsertDB.asp" method="get" id="form1" name="form1">
	<input id="UserName" name="UserName" class="ghi" >
	<INPUT type="submit" value="Submit" id=submit2 name=submit2>
</FORM>


any Idea PLEASE....
ou812

 

Posts: 1566
Joined: 1/5/2002
From: San Diego
Status: offline

 
RE: submit problem - 2/11/2008 14:17:12   
Lots of folks use JavaScript for this type of checking. Here are just a few examples:
http://javascript.internet.com/forms/personal-details-validation.html
http://javascript.internet.com/forms/required-fields.html
http://javascript.internet.com/forms/ultimate-form-validator.html

The site has many more: http://javascript.internet.com/forms/

Or you could check using ASP, after they submit, checking for the empty fields and then redirect them back to the form.


_____________________________

-brian

EnterpriseDB: Enterprise-class relational database management system
PostgreSQL: The world's most advanced open source database

(in reply to wizard_oz)
Catherine Sea

 

Posts: 2
Joined: 1/1/2008
Status: offline

 
RE: submit problem - 2/25/2008 20:22:56   
You can use the event handler called onsubmit to check the fields.
Below is the code:
<script language="javascript">
function checkfields()
{
var txtUserName = document.getElementById("UserName");
if(txtUserName && txtUserName.value == "")
{
alert("the feild is empty");
return false;
}
}
</script>
<form action="InsertDB.asp" method="get" id="form1" name="form1" onsubmit="return checkfields()">
<input id="UserName" name="UserName" class="ghi" >
<INPUT type="submit" value="Submit" id=submit2 name=submit2 >
</FORM>


This code works well.
I hope this will help you.

--
Catherine Sea
http://www.dynamsoft.com/

(in reply to wizard_oz)
Page:   [1]

All Forums >> Web Development >> General Web Development >> submit problem
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts