| CakePHP Official Site · Rules and Regulations |
Help
Search
Members
Calendar
Shoutbox
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
![]() ![]() ![]() |
| bluesclues9 |
Posted: Feb 23 2012, 06:52 PM
|
|
Member ![]() ![]() Group: Members Posts: 11 Member No.: 2721 Joined: 3-March 11 |
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. -BC |
| Vapour0 |
Posted: Feb 23 2012, 09:34 PM
|
||
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 43 Member No.: 3251 Joined: 2-December 11 |
That should help. Just assign the label as an array, then add 'class' or 'id' keys. And Text for the display text. |
||
| bluesclues9 |
Posted: Feb 23 2012, 09:44 PM
|
|
Member ![]() ![]() Group: Members Posts: 11 Member No.: 2721 Joined: 3-March 11 |
Hi
This is what I normally do for all input types. However, this doesn't work for Radio button inputs. The label specifications are completely ignored. -BC |
| Vapour0 |
Posted: Feb 23 2012, 10:05 PM
|
||
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 43 Member No.: 3251 Joined: 2-December 11 |
What about this?
Does that work? Using 3 parameters and $this->Form->radio( $1, $2, $3 ) |
||
| bluesclues9 |
Posted: Feb 24 2012, 03:35 AM
|
|
Member ![]() ![]() Group: Members Posts: 11 Member No.: 2721 Joined: 3-March 11 |
Hi, thanks for the response. I tried. The label just shows up like this.
label attribute settings are ignored on label. <input type="radio" name="data[Agreement][contracttype]" id="AgreementContracttypeContract" value="Contract"> <label for="AgreementContracttypeContract">Contract</label> |
![]() |
![]() ![]() ![]() |