Welcome Guest, Not a member yet? Register   Sign In
Radio Group - setting one as checked on edit of data
#1

[eluser]nevsie[/eluser]
I have a simple radio group of three options "yes", "no" and "maybe"

Code:
echo form_radio('radiogroup', 'Yes', $radiogroup_value, 'class="radio"');
echo form_radio('radiogroup', 'No', $radiogroup_value, 'class="radio"');
echo form_radio('radiogroup', 'Maybe', $radiogroup_value, 'class="radio"');

I was under the impression that as with select box the $radiogroup_value would be checked against the value for that field and then evaluate it as true or false and display checked/selected accordingly...

But this is not playing or doing anything...

Any advice appreciated or do i need to check and validate this myself and display in the field accordingly.
#2

[eluser]mddd[/eluser]
You have to put TRUE or FALSE as the third parameter. Not the value itself. I can see that in a group it would make sense to use the value as you are describing.
But CodeIgniter treats a radiobutton the same way as a checkbox. So you have to indicate whether you want it checked or not.
#3

[eluser]nevsie[/eluser]
Annoyingly that is what i thought!!! Hence i have scripted it in the template to do the check.
Do you (anyone) agree that this would be suited to checks similar to a select box as opposed to a check box? Should it be feature suggested???

I am guessing you could easily check to see if it is TRUE/FALSE and if not treat it a a value to confirm against the value in the element.




Theme © iAndrew 2016 - Forum software by © MyBB