Hi!
I'm trying to clean a value from a text-box depending of the option selected in a dropdown.
One way is use events to enable or disable the text-box dending of the value selected in de dropdown, BUT is an user put manually some data in the text-box, after that change the dropdown option and the text-box is "disabled", the data inserted remains. I need to clean this data if the text-box is disable (when 1 option from the dropdown is selected).
Can I do this using "events" inside the dropdown?
I try to use this JS code too (added in SETUP -> onload event), but it didn't work:
I'm trying to clean a value from a text-box depending of the option selected in a dropdown.
One way is use events to enable or disable the text-box dending of the value selected in de dropdown, BUT is an user put manually some data in the text-box, after that change the dropdown option and the text-box is "disabled", the data inserted remains. I need to clean this data if the text-box is disable (when 1 option from the dropdown is selected).
Can I do this using "events" inside the dropdown?
I try to use this JS code too (added in SETUP -> onload event), but it didn't work:
window.addEvent('domready', function() {
var select, other;
select = $('dropdownID');
other = $('textboxID');
switchOther();
select.addEvent('change', switchOther);
function switchOther() {
if ( select.value == '1' ) {
other.disabled = false;
} else {
other.value = '';
other.disabled = true;
}
}
});