Jump to content

Submit, field entry missing, reset?


kurt.santo

Recommended Posts

Is it not possible to reset a from via JavaScript once the submit button is pressed (but has not gone through due to failure to fill out required fields)? Got some help how to reset via Javascript, but does not work once the submit button is pressed. As the form fields are sticky, would really like to give option to clear...Kurt

Link to comment
Share on other sites

Edit: TYPO - recopy (or just change your version)

function handler(form) {	if (!validates(form)) {		form.reset();		return false;	}}

<form onsubmit="return handler(this)">	...</form>

Link to comment
Share on other sites

function hander(form) {	if (!validates(form)) {		form.reset();		return false;	}}

<form onsubmit="return handler(this)">	...</form>

Synook,Tested it in IE7, but does not work as the other scripts I used. Maybe this is a thing, which is not possible? Tried so many things now...Kurt
Link to comment
Share on other sites

I just tried almost the same code in FF Mac. Works fine.Tell me that if you copied and pasted you caught the spelling error in this:function hander(form) {
No, its not working. Spotted the spelling mistake as well... The thing is that I only now also realise that this script cannot work with my contact page. As I said above (first post) the form fields are sticky and I want to keep it this way. This means if the entries do not validate I still want to keep the entries. I just found on internet a good source, which explained that you cannot reset a sticky form field. Reset sets the fields to their initial value. In his case the sticky form value. Will try now to check server side possiblities to amend the stickyness...Thanks,Kurt
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...