Discussion:
Radio with WRONG LABEL ID
l***@public.gmane.org
2009-08-27 11:19:44 UTC
Permalink
HI,

I can't resolve a strange problem. This is my code:

echo $form->input('User.SecurityAccess.'.$aco_id,
array
(
'div' => false,
'label' => false,
'type' => 'radio',
'legend' => false,
'default' => $selected,
'options' => array('allow' => " {$allow}",
'deny' => " {$deny}")
)
);

I try to create a set of radio groups, every group has 2 raàdio
buttons. I want taht every radio group has different id in their
label, so the user can click directly on the label, BUT CAKE SEEMS TO
PUT the same id in the code. This is the resulting code:

<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessAllow" value="allow" />
<label for="GroupSecurityAccessAllow">&nbsp;Allow</label>

<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessDeny" value="deny" checked="checked" />
<label for="GroupSecurityAccessDeny">&nbsp;<span style = 'color:
red'>Deny</span></label>

The other pairs of radio buttons has the SAME LABEL ID.

ANY IDEAS?

Tnx!!
Miles J
2009-08-27 16:36:28 UTC
Permalink
Um correct me if im wrong, but in the example you showed me the IDs
are different and correct.
delocalizer
2009-08-28 02:25:54 UTC
Permalink
Do you mean the name is the same? Because it is supposed to be - both
buttons provide a value to the same field.
What is the symptom of your problem?
Post by l***@public.gmane.org
HI,
echo $form->input('User.SecurityAccess.'.$aco_id,
                  array
                  (
                    'div' => false,
                    'label' => false,
                    'type' => 'radio',
                    'legend' => false,
                    'default' => $selected,
                    'options' => array('allow' => " {$allow}",
'deny' => " {$deny}")
                  )
            );
I try to create a set of radio groups, every group has 2 raàdio
buttons. I want taht every radio group has different id in their
label, so the user can click directly on the label, BUT CAKE SEEMS TO
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessAllow" value="allow"  />
<label for="GroupSecurityAccessAllow"> Allow</label>
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessDeny" value="deny" checked="checked"  />
red'>Deny</span></label>
The other pairs of radio buttons has the SAME LABEL ID.
ANY IDEAS?
Tnx!!AS?
Tnx!!
brian
2009-08-28 15:12:09 UTC
Permalink
I think the problem is not so much the value of the labels' "for"
attribute (NOT the id, which it doesn't have) but the id of the radio
elements. There are several groups of these, so there are several
radio buttons with the same id.
Post by delocalizer
Do you mean the name is the same? Because it is supposed to be - both
buttons provide a value to the same field.
What is the symptom of your problem?
Post by l***@public.gmane.org
HI,
echo $form->input('User.SecurityAccess.'.$aco_id,
                  array
                  (
                    'div' => false,
                    'label' => false,
                    'type' => 'radio',
                    'legend' => false,
                    'default' => $selected,
                    'options' => array('allow' => " {$allow}",
'deny' => " {$deny}")
                  )
            );
I try to create a set of radio groups, every group has 2 raàdio
buttons. I want taht every radio group has different id in their
label, so the user can click directly on the label, BUT CAKE SEEMS TO
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessAllow" value="allow"  />
<label for="GroupSecurityAccessAllow"> Allow</label>
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessDeny" value="deny" checked="checked"  />
red'>Deny</span></label>
The other pairs of radio buttons has the SAME LABEL ID.
ANY IDEAS?
Tnx!! AS?
Tnx!!
ProgDario
2009-09-01 20:28:50 UTC
Permalink
You're right brian, two radios for every group, so the two radios
shown have different ids but another group has the same id.

Any ideas to correct this?


Thanks!!
Post by brian
I think the problem is not so much the value of the labels' "for"
attribute (NOT the id, which it doesn't have) but the id of the radio
elements. There are several groups of these, so there are several
radio buttons with the same id.
Post by delocalizer
Do you mean the name is the same? Because it is supposed to be - both
buttons provide a value to the same field.
What is the symptom of your problem?
Post by l***@public.gmane.org
HI,
echo $form->input('User.SecurityAccess.'.$aco_id,
                  array
                  (
                    'div' => false,
                    'label' => false,
                    'type' => 'radio',
                    'legend' => false,
                    'default' => $selected,
                    'options' => array('allow' => " {$allow}",
'deny' => " {$deny}")
                  )
            );
I try to create a set of radio groups, every group has 2 raàdio
buttons. I want taht every radio group has different id in their
label, so the user can click directly on the label, BUT CAKE SEEMS TO
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessAllow" value="allow"  />
<label for="GroupSecurityAccessAllow"> Allow</label>
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessDeny" value="deny" checked="checked"  />
red'>Deny</span></label>
The other pairs of radio buttons has the SAME LABEL ID.
ANY IDEAS?
Tnx!! AS?
Tnx!!- Nascondi testo citato
- Mostra testo citato -
delocalizer
2009-09-02 03:23:57 UTC
Permalink
You can specify 'id' directly in input method like this:
$form->input('User.SecurityAccess.'.$aco_id, array(
'id'=>"UserSecurityAccess$aco_id",
....)
);
But the reason the problem is happening in the first place the syntax
of your input fieldname, with $aco_id at the end... try this instead:
$form->input('User.'.$aco_id.'.SecurityAccess, array(
...)
);
Post by ProgDario
You're right brian, two radios for every group, so the two radios
shown have different ids but another group has the same id.
Any ideas to correct this?
Thanks!!
Post by brian
I think the problem is not so much the value of the labels' "for"
attribute (NOT the id, which it doesn't have) but the id of the radio
elements. There are several groups of these, so there are several
radio buttons with the same id.
Post by delocalizer
Do you mean the name is the same? Because it is supposed to be - both
buttons provide a value to the same field.
What is the symptom of your problem?
Post by l***@public.gmane.org
HI,
echo $form->input('User.SecurityAccess.'.$aco_id,
                  array
                  (
                    'div' => false,
                    'label' => false,
                    'type' => 'radio',
                    'legend' => false,
                    'default' => $selected,
                    'options' => array('allow' => " {$allow}",
'deny' => " {$deny}")
                  )
            );
I try to create a set of radio groups, every group has 2 raàdio
buttons. I want taht every radio group has different id in their
label, so the user can click directly on the label, BUT CAKE SEEMS TO
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessAllow" value="allow"  />
<label for="GroupSecurityAccessAllow"> Allow</label>
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessDeny" value="deny" checked="checked"  />
red'>Deny</span></label>
The other pairs of radio buttons has the SAME LABEL ID.
ANY IDEAS?
Tnx!! AS?
Tnx!!- Nascondi testo citato
- Mostra testo citato -
ProgDario
2009-09-03 08:37:15 UTC
Permalink
DELOCALIZER YOU ARE THE GOD!!

IT WORKS, IT FU**ING WORKS!!

THANK YOU SO MUCH!!
Post by delocalizer
$form->input('User.SecurityAccess.'.$aco_id, array(
    'id'=>"UserSecurityAccess$aco_id",
    ....)
);
But the reason the problem is happening in the first place the syntax
$form->input('User.'.$aco_id.'.SecurityAccess, array(
    ...)
);
Post by ProgDario
You're right brian, two radios for every group, so the two radios
shown have different ids but another group has the same id.
Any ideas to correct this?
Thanks!!
Post by brian
I think the problem is not so much the value of the labels' "for"
attribute (NOT the id, which it doesn't have) but the id of the radio
elements. There are several groups of these, so there are several
radio buttons with the same id.
Post by delocalizer
Do you mean the name is the same? Because it is supposed to be - both
buttons provide a value to the same field.
What is the symptom of your problem?
Post by l***@public.gmane.org
HI,
echo $form->input('User.SecurityAccess.'.$aco_id,
                  array
                  (
                    'div' => false,
                    'label' => false,
                    'type' => 'radio',
                    'legend' => false,
                    'default' => $selected,
                    'options' => array('allow' => " {$allow}",
'deny' => " {$deny}")
                  )
            );
I try to create a set of radio groups, every group has 2 raàdio
buttons. I want taht every radio group has different id in their
label, so the user can click directly on the label, BUT CAKE SEEMS TO
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessAllow" value="allow"  />
<label for="GroupSecurityAccessAllow"> Allow</label>
<input type="radio" name="data[Group][SecurityAccess][4]"
id="GroupSecurityAccessDeny" value="deny" checked="checked"  />
red'>Deny</span></label>
The other pairs of radio buttons has the SAME LABEL ID.
ANY IDEAS?
Tnx!! AS?
Tnx!!- Nascondi testo citato
- Mostra testo citato -- Nascondi testo citato
- Mostra testo citato -
Loading...