Radio usage example
Usage example
<?php
$form = new \Construct\Form();
// Add values and indexes
$values = array(
array('1', 'First'),
array('2', 'Second'),
array('3', 'Third')
);
// Another way to add radio buttons
$values = array('First', 'Second', 'Third');
// Add a field
$form->addField(new \Construct\Form\Field\Radio(
array(
'name' => 'myRadio', // set HTML 'name' attribute
'values' => $values,
'value' => 2 // Check a second item
)));
echo $form->render();
Since Construct 4.2.3 version $values can be passed as one level array
$values = array('First', 'Second', 'Third');