Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Smile Radio button group

    I have two radio groups. Say one for food option and the other one for toppings.
    I want to enable toppings radio group to appear only after food option is selected.

    <legend>Choose the pizza wrap type ?</legend>
    <div class="control-group"> /*radio group for food option*/
    <label class="radio">
    <input type="radio" name="pi" id="pi3"value="3" {% if pi.rel == 3%}
    checked {% endif %}>
    Vegan
    </label><br>
    <label class="radio">
    <input type="radio" name="pi" id="pi2" value="2" {% if pi.rel == 2 %}
    checked {% endif %}>
    Vegetarian
    </label><br>
    <label class="radio">
    <input type="radio" name="relevance" id="relevance1" value="1" {% if
    pi.rel == 1 %} checked {% endif %}>
    Non vegetarian
    </label><br>
    <label class="radio">
    <input type="radio" name="relevance" id="relevance0" value="0" {% if
    pi.rel == 0 %} checked {% endif %}>
    Halal meat
    </label>
    </div>

    <h5>Toppings?</h5>
    <div class="control-group"> /*radio group for topping option*/
    <label class="radio">
    <input type="radio" name="top" id="top3" value="3" {% if top.rel == 3
    %} checked {% endif %}>
    Vegan
    </label><br>
    <label class="radio">
    <input type="radio" name="top" id="top2" value="2" {% if top.rel == 2
    %} checked {% endif %}>
    Veggie
    </label><br>
    <label class="radio">
    <input type="radio" name="top" id="top1" value="1" {% if top.rel == 1
    %} checked {% endif %}>
    Meat
    </label><br>
    <label class="radio">
    <input type="radio" name="top" id="top" value="0" {% if top.rel == 0
    %} checked {% endif %}>
    Halal meat
    </label>
    </div>

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    Where is your Javascript code for this?

    Generally: You should set display:"none" for the second control-group by default. Then write some Javascript that will set display to "block" or to "" onclick on any of the radio buttons of the first group

  • Users who have thanked devnull69 for this post:

    rads19 (10-01-2013)

  • #3
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    EDIT: Removed double post

  • Users who have thanked devnull69 for this post:

    rads19 (10-01-2013)

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    You posted in the wrong forum. Please read this sticky post.

    The correct forum for this is the Javascript Forum.

    A moderator should move this post or delete it as he/she deems fit.

  • Users who have thanked glenngv for this post:

    rads19 (10-01-2013)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •