RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

help in validation by javascript

Join Date: Jul 2006
Location: Deptford, London
Posts: 985
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 6
Solved Threads: 51
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: help in validation by javascript

  #3  
Apr 30th, 2007
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:

[incorrect]

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..
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:59 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC