On 23 Feb 2012, at 18:49, Blues Clues <[email protected]> wrote:
> Hi:
> I am completely lost with this.
>
> I am using Form helper in CakePHP and embedded a Radio input into it.
> The problem is that I need to set either class or id property for the
> label next to Radio to control it using css.
>
> My code looks like this.
> <?php
> $contract_type_options = array("Contract" => "Contract", "Remnant" =>
> "Remnant");
> echo $this->Form->input('Agreement.contracttype', array('type' =>
> 'radio', 'id' => 'idContractType', 'class' => 'classContractType',
> 'div' => false, 'options' => $contract_type_options));
> ?>
>
> and the generated HTML looks like this:
>
> <input type="hidden" name="data[Agreement][contracttype]"
> id="idContractType_" value="">
> <input type="radio" name="data[Agreement][contracttype]"
> id="IdContractTypeContract" class="classContractType"
> value="Contract">
> <label for="IdContractTypeContract">Contract</label>
> <input type="radio" name="data[Agreement][contracttype]"
> id="IdContractTypeContract" class="classContractType" value="Remnant">
> <label for="IdContractTypeContract">Remnant</label>
>
> What I am looking for is to have a class and/or id assigned to those
> "<label for="IdContractTypeContract">Contract</label>" like <label
> for="IdContractTypeContract" class="classRadioLabel">Contract</label>
>
> What am I doing wrong here? Please help...I am going nuts with this.
Remove div=false and youll get a wrapper around your whole radios. Probably
<div class='input radio'> or similar. Then you can select your labels by .radio
label {}
Labels should all have the same treatment so you won't need to add a class to
them specifically.
Hth
>
> -BC
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php