Reputation: 4330
I need create following html code for working with bootstap
<div class="input-group">
<span class="input-group-addon">
<input type="radio">
</span>
<input type="text" class="form-control">
</div>
So I need single radio button with out any label and legend. I just try as follows.
echo $this->Form->radio('Answer.0.correct', array(
'value' => 1,
));
It has generate following html
<input type="hidden" value="" id="Answer0Correct_" name="data[Answer][0][correct]">
<input type="radio" value="value" id="Answer0CorrectValue" name="data[Answer][0][correct]">
<label for="Answer0CorrectValue">1</label>
I set label option as false.
echo $this->Form->radio('Answer.0.correct', array(
'value' => 1,
'label' => false,
));
But it had create unwanted radio with fieldset.
<fieldset>
<legend>Correct</legend>
<input type="hidden" value="" id="Answer0Correct_" name="data[Answer][0][correct]">
<input type="radio" value="value" id="Answer0CorrectValue" name="data[Answer][0][correct]">
<label for="Answer0CorrectValue">1</label>
<input type="radio" value="label" id="Answer0CorrectLabel" name="data[Answer][0][correct]">
<label for="Answer0CorrectLabel"></label>
</fieldset>
How can i create single radio button (with his hidden field)?
Upvotes: 0
Views: 3414
Reputation: 4776
$options = array('1' => false, '2' => false);
$attributes = array('legend' => false, 'label' => false);
echo $this->Form->radio('gender', $options, $attributes);
Upvotes: 2
Reputation: 418
Try this :-
$attributes = array('1' =>false);
echo $this->Form->radio('Answer.0.correct', $attributes);
Upvotes: 0
Reputation: 1066
If you cannot generate the desired output with the Form Helper, you can still just write the HTML code in your view file. So in your index.ctp or *.ctp just put
<div class="input-group">
<span class="input-group-addon">
<input type="radio">
</span>
<input type="text" class="form-control">
</div>
and you are all set. I don't understand why you HAVE to generate this markup with the Form Helper.
Upvotes: -1