Click to See Complete Forum and Search --> : javascript needed


josepich
10-13-2003, 12:57 AM
I basically need a form script that disable text input fields when a change on a selected option is made and another that places an editable value on a text input field.
Any help????

lillu
10-13-2003, 05:03 AM
Either set the disabled property in html or via javascript.

HTML:
<input type="text" name="text1" disabled="disabled" /> or
<input type="text" name="text1" disabled />

Javascript:
text2.disabled=false;
text2.disabled=true;

The default value property is script-only, but if you specify the value attribute, that will give the textbox an initial value.

HTML:
<input type="text" name="text2" value="value2" />

Javascript:
text2.defaultValue = "newdefaultvalue";

Make sure use reference the textbox object correctly in your script.