+ Reply to Thread
Results 1 to 4 of 4

Thread: Radio buttons

  1. #1
    gastoncs is offline Junior Member
    Join Date
    Apr 2009
    Location
    Albany NY USA
    Posts
    3

    Default Radio buttons

    Hi I am trying to create radio buttons on zend this is the way i want to do it.

    ()Yes ()No Jonh Smith
    ()Yes ()No Peter Fallon

    I want to attach two radio buttons to one id.

    Thanks

  2. #2
    Regx is offline Junior Member
    Join Date
    Apr 2009
    Location
    The Netherlands
    Posts
    9

    Default Place this code in your view

    Place this code in your view:
    [PHP]
    <p>
    <?= $this->formRadio('johnsmith', '1', array(), array('1' => 'Yes', '0' => 'No'), ' '); ?>
    &nbsp;&nbsp;<strong>John Smith</strong>
    </p>
    <p>
    <?= $this->formRadio('peterfallon', '1', array(), array('1' => 'Yes', '0' => 'No'), ' '); ?>
    &nbsp;&nbsp;<strong>Peter Fallon</strong>
    </p>
    [/PHP]

    Which will output exactly the same as you described:
    [HTML]
    <p>
    <label for="johnsmith-1">
    <input type="radio" name="johnsmith" id="johnsmith-1" value="1" checked="checked">
    Yes</label>
    <label for="johnsmith-0">
    <input type="radio" name="johnsmith" id="johnsmith-0" value="0">
    No</label>
    &nbsp;&nbsp;<strong>John Smith</strong>
    </p>
    <p>
    <label for="peterfallon-1">
    <input type="radio" name="peterfallon" id="peterfallon-1" value="1" checked="checked">
    Yes</label>
    <label for="peterfallon-0">
    <input type="radio" name="peterfallon" id="peterfallon-0" value="0">
    No</label>
    &nbsp;&nbsp;<strong>Peter Fallon</strong>
    </p>
    [/HTML]

    I know, there isn't enough documentation about some of the form view helpers out there...
    You need to take a look at the sourcecode sometimes

  3. #3
    gastoncs is offline Junior Member
    Join Date
    Apr 2009
    Location
    Albany NY USA
    Posts
    3

    Default

    You are right is not that many Thanks for your help

  4. #4
    Regx is offline Junior Member
    Join Date
    Apr 2009
    Location
    The Netherlands
    Posts
    9

    Default

    Your welcome

+ Reply to Thread

Similar Threads

  1. zend_form with multiple submit buttons
    By Stryks in forum Model-View-Controller (MVC)
    Replies: 4
    Last Post: 07-22-2010, 02:50 PM
  2. Radio Button Decorator?
    By altergothen in forum Core Infrastructure
    Replies: 0
    Last Post: 03-02-2009, 08:22 AM
  3. Zend_Form Radio button Newbie
    By altergothen in forum Core Infrastructure
    Replies: 2
    Last Post: 12-23-2008, 08:23 AM
  4. two buttons in one for?
    By cantona in forum Core Infrastructure
    Replies: 5
    Last Post: 09-05-2008, 01:41 PM
  5. Radio buttons in .ini file
    By robboguy in forum Core Infrastructure
    Replies: 1
    Last Post: 05-17-2008, 04:15 AM

Posting Permissions

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