954,180 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

On change Select option, clear fields

Hi,

I'm sure this should be easy, but just can't work it out.

I have a select dropdown with several options. The user selects an option and fills out the following few fields. If the user then changes his mind and changes the option in the dropdown, I want all the fields - or just the ones already filled out - to be cleared.

Note: reset() of the form is not an option as there are other things going on (hide/display of fields based on the dropdown option selected).

Any help is much appreciated!

lewilaloupe
Newbie Poster
6 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

That is indeed easy to do:

<select onchange='clearFields()'>
.... Some other html etc....
<input type='text' id='InputId' maxlength='255' />


And then the javascript:

function clearFields() {
 document.getElementById('InputId').value = "";
}


~G

Graphix
Posting Pro in Training
432 posts since Aug 2009
Reputation Points: 82
Solved Threads: 74
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You