| | |
Alert for missing information
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 4
Reputation:
Solved Threads: 0
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(first name,"Missing Information!")==false)
{first name.focus();return false;}
}
}
<form action="submitpage.htm"
onsumbit="return validate_form(this)"
method="post">
</form>
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(first name,"Missing Information!")==false)
{first name.focus();return false;}
}
}
<form action="submitpage.htm"
onsumbit="return validate_form(this)"
method="post">
</form>
Lets head back to the basic! Hope this 1 wil help you! Good day!
html Syntax (Toggle Plain Text)
<html> <head> <title><!--Sample--></title>
javascript Syntax (Toggle Plain Text)
<script type="text/javascript"> <!-- function validate( form ) { var nameField = form.firstname; if ( nameField.value == "" ) { alert('\nMissing Information!'); nameField.focus(); return false; } else { alert('\nDo the next stuff!'); return true; } } //--> </script>
html Syntax (Toggle Plain Text)
</head> <body> <form action="submitpage.htm" name="form1" onsubmit="return validate( this );" method="post"> <input type="text" name="firstname" size="20" value="" /><br /> <input type="submit" value="Submit" /> </form> </body> </html>
![]() |
Similar Threads
- System alert pop up (Viruses, Spyware and other Nasties)
- New User-Bogus Windows Alert-hijackthis log encl (Viruses, Spyware and other Nasties)
- virus alert notification icon (help) (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Readonly fields and onchange
- Next Thread: eliminating active-x warnings for pop-up
Views: 762 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxcode ajaxhelp animate api automatically beta boarder box bug button calendar card checkbox child class column cookies createrange() css cursor decimal design dom download dropdown editor element error events explorer firehose flash form forms google gwt html htmlform ie8 iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jump listbox math matrixcaptcha microsoft mimic mp3 mp4 mysql object offline onmouseover onreadystatechange parameters parent passing php player post problem progressbar rating regex runtime search select session shopping size sql star starrating stars stretch text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml xspf \n






