| | |
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 |
acid2 ajax ajaxexample ajaxjspservlets array beta browser captchaformproblem cart child class close codes column css date debugger decimal dependent design disablefirebug dom download editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index java javascript javascripthelp2020 jquery jsf jsp jump libcurl listbox maps masterpage math media menu mp4 object onerror onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming prototype rated rating redirect safari scale scriptlets scroll search security select software star starrating stars synchronous toggle unicode variables w3c web webservice \n






