Originally Posted by Fungus1487
<input type='button'
onclick="isEmpty(document.getElementById('name'), 'Please Enter a Value')"
value='Check Field' />
that won't validate on submit, it'll validate, but not submit. if you want to validate, you have to conditionally stop the submit, which is done by returning false within an onsubmit event. the function is right, but the call to it is not making full use of its potential.
keeping your function Fungus1487; try:
EDIT:
I tell a lie! onsubmit is a form event not a submit button event:
<form action="anactionhandler.cgi" method="GET" onsubmit="return ! isEmpty(document.getElementById('name'),
'Please Enter a Value')">
Name : <input type='text' id='name'/>
<input type='submit' value='Submit!' />
</form> Last edited by MattEvans : Apr 30th, 2007 at 7:53 am.
Plato forgot the nullahedron..