CakePHP : Form Radio Default Checked Value

With the CakePHP FormHelper, you can output a set or a list of radio button widgets.

Usage

<?= $form -> radio($field, $options, $attributes); ?>

Example

<?= $form -> radio('Model.field', array('Option1', 'Option2', 'Option3'), array('default' => 'option2')); ?>

In the line of code above, you’ll notice the default attribute value. This specifies the value of the radio button which will be checked by default in case there is currently no value passed through the model data.

Comments

  1. By Safi

  2. By jeffery

  3. By Gaurav

  4. By jack

  5. By nano

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

%d bloggers like this: