learningcurve Posted July 26, 2013 Share Posted July 26, 2013 I know this can be done, but I just can't write the javascript correctly to make it work. I have these two form elements: <input type="radio" name="JECT" value="no" checked <?php if(@$JECT=="no"){ echo "checked";}?>> No thanks</br> <input type='radio' name='JECT' value='JECTindividual_print' <?php if(@$JECT=="JECTindividual_print"){ echo "checked";}?>> Print subscription (US and Canada only): US $<?php echo $JECTindividual_print_price['base']['United States']; ?>, Canada $<?php echo $JECTindividual_print_price['base']['Canada']; ?></br> <input type='radio' name='JECT' value='JECTindividual_electronic' <?php if(@$JECT=="JECTindividual_electronic"){ echo "checked";}?>> Electronic subscription (access to complete online archive): $<?php echo $JECTindividual_electronic_price['base']; ?></br> <input type='radio' name='JECT' value='JECTindividual_combo' <?php if(@$JECT=="JECTindividual_combo"){ echo "checked";}?>> Combination print and electronic subscription (US and Canada only): $<?php echo $JECTindividual_combo_price['base']; ?></br> <p style="text-indent:30px;">Length of subscription:</br></p> <label><input type="radio" name="JECTsub" value="1" checked <?php if(@$JECTsub=="1"){ echo "checked";}?>> 1 year</label></br> <label><input type="radio" name="JECTsub" value="2" <?php if(@$JECTsub=="2"){ echo "checked";}?>> 2 years</label></br> <label><input type="radio" name="JECTsub" value="3" <?php if(@$JECTsub=="3"){ echo "checked";}?>> 3 years</label></br> <label><input type='checkbox' name='JECTrenewal' value='yes' <?php if(@$JECTrenewal=="yes"){ echo "checked";}?>> Check box if this is a renewal</label></br> If the "no" radio button is checked (in other words, if $JECT="no", I want the JECTsub radio buttons to not show. if any other value is chosen for JECT, I want the JECTsub buttons to show. Thanks ahead for the help. Quote Link to comment https://forums.phpfreaks.com/topic/280554-blockshow-form-element-based-on-previous-choice/ Share on other sites More sharing options...
Muddy_Funster Posted August 3, 2013 Share Posted August 3, 2013 why would you give all the radio buttons the same name? especialy if they don't have an id to make them uniquely identifiable. I suggest fixing that first, and then apply a class to the radio buttons that you want to selectivly show then just change the display of this class using javascript to suit. Quote Link to comment https://forums.phpfreaks.com/topic/280554-blockshow-form-element-based-on-previous-choice/#findComment-1443373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.