Jump to content

block/show form element based on previous choice


learningcurve

Recommended Posts

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. 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.