|
Posted by Kimmo Laine on 11/21/06 08:00
"IchBin" <weconsul@ptd.net> wrote in message
news:x_-cnfV-DsKWwf_YUSdV9g@ptd.net...
>I am trying to programmatically set a radio button in a table of radio
>buttons. I have two problems with the code below:
>
> 1 - I can not prepare the <Form> statement to be printed by php. (syntax
> of the hyphens, quotes) my fault!
>
> 2 - If I delete the <Form> and </Form> statements I can build the table
> of radio buttons correctly, HTML wise. The fifth radio button has
> 'checked=True'. The problem is even though I set radio button 5 to be
> checked only the last radio button is checked when it is displayed on the
> screen. But viewing the page code says it should be the fifth radio
> button.
>
> Anybody have some ideas, I'm lost.
You're not using the checked attribute correctly. It has no value true or
false. If you wish to assign a value to it (in xhtml you MUST assign a value
to it) the value is "checked". However the value is not evaluated ever, it's
just a dummy placeholder. Just the presence of the checked attribute means
that the button should be checked, weather it's value is set to "true",
"false" or "barbara streisand". When you have a zillion buttons that all are
checked, the last one remains checked. This is what you are experiecing
right:
<input type="radio" name="foo" checked="checked" />
<input type="radio" name="foo" />
<input type="radio" name="foo" />
wrong:
<input type="radio" name="foo" checked="true" />
<input type="radio" name="foo" checked="false" />
<input type="radio" name="foo" checked="donald duck" />
(All are checked)
Only set the checked attiribute to the element you want checked, and it's
value should be "checked", and not set it to any of the other elements.
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|