tags:

views:

25

answers:

2

with config div => false

$form->input('chexkbox');

print

<input type="checkbox" value="1" ....>
<label>checkbox</label>

but i want it reverse order

<label>checkbox</label>
<input type="checkbox" value="1" ....>

can it reverse ?

A: 

It's often easier to do things manually if the generic FormHelper::input wrapper doesn't fit your bill:

echo $form->label('fieldname');
echo $form->checkbox('fieldname');

I often don't use FormHelper::input beyond scaffolding.

deceze
sorry but I often use table in form :D
meotimdihia
@meotim And why does that prevent you from writing it this way?
deceze
A: 

You can do this by setting the label to false and using the option "before" to display the label where you want.

<?php echo $form->input('checkbox', 
    array(
      'label'=>false, 
      'type'=>'checkbox',
      'before' => '<label>checkbox</lablel>', 
      'div' => false
 )); ?>

Useful links

If not this, then you can use the Form element specific methods, instead of the automagic form elements.

ShiVik
And that's exactly why I prefer the Form element specific methods, instead of wrestling with the options array. ;) Valid answer nonetheless.
deceze
it dont wrestling with options array if checkbox can reverse easily.With inputDefault , you can config fast
meotimdihia