Forum Moderators: open

Message Too Old, No Replies

Problems with disabling text fields

         

ripek

9:48 pm on Nov 27, 2004 (gmt 0)



Hello I have something like this :

PHP:
<input TYPE=text name='itemid[1]' value='1' size=30 disabled>
<input TYPE=checkbox name="aktywny[]" value="1">

<input TYPE=text name='itemid[2]' value='2' size=30 disabled>
<input TYPE=checkbox name="aktywny[]" value="2">

<input TYPE=text name='itemid[3]' value='3' size=30 disabled>
<input TYPE=checkbox name="aktywny[]" value="3">

etc ...

Now I need to add onclick method to the checkbox that will ENABLE/distable the apropriate text field. I mean

checkbox that has value "1" enables/disables the text field which has the "1" VALUE.

Any ideas?

I have tried something like this :

<form ACTION="" name=test>
<input TYPE="abc[123a]" value='aaa' disabled> <input TYPE="checkbox" onclick="document.test.abc['123a'].enabled">
</FORM>

But it doesn't work :(

DrDoc

9:27 pm on Nov 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

You're on the right track. However, instead of:
onclick="document.test.abc['123a'].enabled"

...you want to do:
onclick="document.test.abc['123a'].disabled=false"

If you later need to disable a field again...
document.test.abc['123a'].disabled=true