Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

CheckBox and TextBox relation


Recommended Posts



I searched for information about this topic but I have not found anything that could help me.


I would like to write to a textbox in relation to the selection of a checkbox, how does amazon on its login page, asking if you have a password or not. If you say yes, then the textbox where insert it becomes writable and changes color. Is it possible just with php codes without scripts?





PS: I enclose part of my code as a reference.


<td align="right"><?php echo tep_draw_radio_field('new_customer','Y',false) ?></td>
<td><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
<td class="main"><?php echo TEXT_HAVE_PASSWORD_NO ?></td>
<td align="right"><?php echo tep_draw_radio_field('new_customer','N',true) ?></td>
<td><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
<td class="main"><?php echo TEXT_HAVE_PASSWORD_YES ?></td>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '5', '1'); ?></td>
<td><?php echo tep_draw_password_field('password','','maxlength="40"'); ?></td>

Link to comment
Share on other sites

I haven't looked at the Amazon code, but if I were to implement something like this from scratch, I'd do it in Javascript. The password input field would initially have the disabled attribute. Upon clicking of the radio button or checkbox, the "disabled" attribute is removed and perhaps the "enter password here" text is removed and the color changed. It could be done without Javascript, but you'd have to submit the form after checking the button and the server would send back the refreshed page with the entry field enabled.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...