Blocking text field when not needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
3hhh
Forum Newbie
Posts: 22
Joined: Wed Sep 10, 2008 12:02 pm

Blocking text field when not needed

Post by 3hhh »

<td height="30"><strong>Do you have a WWW password?</strong></td>
</tr>
<tr>
<td><input name="havePassword" type="radio" value="no" checked="checked" />
No</td>
</tr>
<tr>
<td><input name="havePassword" type="radio" value="yes" />
Yes :
<input name="password" type="password" id="password" />
</td>

Hi guys,

I need help on this. I only want to allow the user to enter the password in the password field textbox if he selects "yes" in the "havePassword" radio button. Thus, by default, I would like to "grey-out / block" the password text field. How can I do that? Appreciate your help.
PietM
Forum Newbie
Posts: 8
Joined: Mon Oct 06, 2008 2:56 am

Re: Blocking text field when not needed

Post by PietM »

You should add a 'enabled="false"' to the password-field. The you could assign an "onclick" javascript function to the "yes" button, that enables the passwordfield when pressed.
Post Reply