Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads | All Downloads

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Swish Templates
   SWiSH Climax
   GimpTalk
   Idea Designs
   Sposatoettore
   Try Acai Berry Diet
   Download Free Ringtones
   Swishzone

Manage your site with Flax Article Content Management System
Check empty field (not submit form if field empty), quick html tutorial
Category : HTML / Javascript | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

We usually use input type submit for our forms to submit data to sime script.

What is the drawback of it ?

Answer : Soem of the fields may be empty but form is submitted.

How to check before submitting?

Answer:

for example you have form with one field and one submit button
then you must set the form name in form tag as name=f1and,
instead of setting type to submit set type of the button to button
and grab the information in onclick event as following.


CODE

<form name=f1 method=post>
Enter your name <input type=text name=n>
<input type=button value='GO'
onclick="if(f1.n.value.length==0) alert('nme empty'); else f1.submit();"
>
</form>




now save the file as test.html, put this code in and response back if any error.


All rights reserved - swish-db.com