I am trying to make a checkbox, with a label before it that is not attached to the input, and a label after the checkbox that controls the actual input. It should look like this on the page:
Account Suspended: [X] Prevent the user from logging in
view.ctp
$this->Form->label('Account Suspended');
$this->Form->input('account_suspended', array(
'type' => 'checkbox',
'label' => 'Prevent the user from logging in'
));
The problem I am having at the moment is that the first label is being created with an automatically generated for attribute that matches the ID of the input, so both labels toggle the checkbox if you click them.
The CakePHP generated markup for the first label looks like this, because it is automatically converting the label value into a camel-case ID for the for attribute:
<label for="CustomerAccountSuspended">Account Suspended:</label>
I want the first label to just be:
<label>Account Suspended:</label>
How can I do this using cakePHP FormHelper, and not resorting to manually entering the label HTML?
It’s possible:
Don’t forget to use translation 😛 Almost every part of every code is reusable. If you don’t need it now, you maybe spare some time in other projects 😉
Greetings
func0der