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. #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 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

  3. Users who have thanked devnull69 for this post:

    rads19 (10-01-2013)

  4. #3
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    EDIT: Removed double post

  5. Users who have thanked devnull69 for this post:

    rads19 (10-01-2013)

  6. #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  7. 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
  •