OZONE Asylum
Forums
DHTML/Javascript
Stopping a form from posting with javascript
This page's ID:
28177
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Yeah well the code above should work. returning false to the onsubmit handler should prevent the form from submitting. onSubmit="return textLimit(this.form.body, 150);" That's not right you actually just want onSubmit="return textLimit(this.body, 150);" You may want to stick some alerts in there to debug [code] function textLimit(field, maxlen) { alert(field.value); if (field.value.length > maxlen) { field.value = field.value.substring(0, maxlen); alert("You have exceeded 150 characters"); return false; } else { return true; } } [/code] [img]http://www.bitdamaged.com/graphics/bitsig.gif[/img] .:[ Never resist a perfect moment ]:.
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »