Adding Radio Buttons To A Form

My searches, both on and off of Dolphin, has not return this.  I want to add a set of radio buttons to a Dolphin form.  Can someone tell me the proper way to do this?  I know how to add other form elements, such as a checkbox, but what is the proper way to add a set of radio buttons?

Geeks, making the world a better place
Quote · 7 May 2013

Is this correct?  Any errors?  Should I use true and false for values?

'inputs' => array(
                    'name_one' => array(
                        'type' => 'radio',
                        'name' => 'radio_group_name',
                        'value' => 0,
                        'caption' => _t('_radio_1_caption'),
                        'display' => true,
                    ),                   
                    'name_two' => array(
                        'type' => 'radio',
                        'name' => 'radio_group_name',
                        'value' => 1,
                        'caption' => _t('_radio_2_caption'),
                        'display' => true,
                    ),

Geeks, making the world a better place
Quote · 7 May 2013

No, that can not be correct as I can not check the input value of the radio choice; while that does produce a set of radio buttons that will toggle correctly, I don't think that will work.

Geeks, making the world a better place
Quote · 7 May 2013

maybe this will help you

from file administration/db.php

    'savetype' => array(
                'type' => 'radio_set',
                'name' => 'savetype',
                'caption' => $sActionC,
                'values' => array (
                    'server' => $sSaveOption1C,
                    'client' => $sSaveOption2C,
                    'show' => $sSaveOption3C,
                ),
            ),

Quote · 7 May 2013

with your code, something like this


$sOption1 = _t('_radio_1_caption');
$sOption2 = _t('_radio_2_caption');
$sTextInfo = _t('_text_info');

    'radio_group_name' => array(
                'type' => 'radio_set',
                'name' => 'radio_group_name',
                'caption' => $sTextInfo,
                'values' => array (
                    '0' => $sOption1,
                    '1' => $sOption2,
                ),
        'db' => array (
                'pass' => 'Xss',
            ),

Quote · 7 May 2013

Yes, radio_set is what I wanted although I will use language keys so the text can be changed based on the language.  Thanks for the help.

Geeks, making the world a better place
Quote · 7 May 2013

Is there a way to default check one of the radio buttons?

Geeks, making the world a better place
Quote · 8 May 2013

Guess not, this is from Dolphin 8 Forms:

  • radio_set - set of radio buttons. It is displayed as set of radio buttons. It is displayed in one row if number of items is equal or less than 3 or every item is displayed on new line if there is more than 3 items in the set.
    Parameters:
    • value - default value (array index of selected radio button from values array), or empty - if there is no default value.
    • values - serialized array of available values, or reference to predefined set of values.
    • checked - not applicable here.
    • collapsed - not applicable here.
    • html - not applicable here.
    • checker_func
      Can be used here: Length, Preg, Avail
      Make no sense to use it here: Email, Date, DateTime, Captcha
    • db_pass
      Can be used here: Int, Float, Xss, All, Preg
      Make no sense to use it here: Date, DateTime, Tags, Categories, XssHtml, Boolean, Set
Geeks, making the world a better place
Quote · 8 May 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.