| | |
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
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically browser bug calendar captchaformproblem checkbox child class close cookies createrange() cursor date debugger dependent disablefirebug dom dropdown editor element embed engine events explorer ext file form forms getselection google gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe image() images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math matrixcaptcha media microsoft object onerror onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post programming progressbar rated regex runtime safari scriptlets scroll search security session shopping size software sql star stars synchronous text textarea unicode validation web webservice website windowsxp wysiwyg \n






