I want to produce a radio button like this:
<input type="radio" name="quest0" value="a" required>
I am doing like this
echo form_radio("quest0","a");
But how can I add required attribute using Codeigniter form helper.
One way is to write as shown by @Shaiful Islam.
Other way is to write as below:
echo form_radio("quest0","a", FALSE, "required=required");
Refer the Source Code - Form Helper - Line 459
You are passing the other parameters as EXTRA attribute
You can add other attributes like id, data-*, required in 4th parameter of form_radio() function, try this code
echo form_radio("quest0","a", false,"required id=\"quest0\"");
form_input(), and form_select, form_radio() function get element attribute in 4th parameter