Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cancel button error FormAction is null

Status
Not open for further replies.

ttrinh

MIS
Jan 21, 2002
93
AU
Hi
I got a problem with the cancel button of my form
when users make changes to the form then click cancel I want it to revert to the saved setting. The problem I am getting is this error : document.Tasks_Priority.FormAction is null or not an object.
When I click the "Undo" button it appears to work although I am getting the above js error
Can anyone tell me what is wrong with my script ?
<input type=&quot;reset&quot; value=&quot;Undo&quot; onclick=&quot;document.Tasks_Priority.FormAction.value = 'cancel';&quot;/>

Thanks

 
I know this is kind of obvious but it never hurts... Your input field is a reset type - meaning that when you press it, all the fields in your form will be cleared. To do anything other than this, you'll have to create a function to restore the values and not rely on a 'reset' button alone.

There's always a better way...
 
Thanks for your suggestion tviman.
Thats what I want it to do - just clear the form /reset it to original . It may have started with items in several fields or may not. The thing is when its a submit button , there are no js errors but it also doesn't work. When its a reset button it works but also returns a js error .
 
If you just want to clear the form, use this:

<input type=&quot;reset&quot; name=&quot;Clear Form&quot;>

Make sure it's between your <form> and </form> tags. There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top