PDA

View Full Version : the type of 'value' attribute of radiobutton


ranzhang
01-19-2006, 02:00 PM
Hi,

From my experience, the value attribute of a <radiobutton> can only take integers. However, radiobutton.value is inherited from Basevaluecomponent and the API of Basevaluecomponent says the type can be 'any'.

Traditionally, the value of a listitem can be string in <option> in html.

I m wondering if this type restriction on radiobutton was a bug or a feature :-)

ran

guyr
06-14-2007, 04:06 PM
I just discovered the same thing. If I use an alphabetic value like "thevalue", OL4 complains "undefined variable thevalue". This is inconvenient. Any solution for this?

senshi
06-17-2007, 08:19 AM
Solution: You have to double quote the string.
Reason: As the type for "value" is "any", the value itself will be treated as a script-expression and gets evaluated.


<canvas debug="true" >

<radiogroup>
<radiobutton text="Selection A" value="'A'" />
<radiobutton text="Selection B" value="'B'" />
<radiobutton text="Selection C" value="'C'" />

<handler name="onselect" args="sel" >
Debug.write( "onselect for:", sel.value );//fired twice, see: "LPP-3560"
</handler>
</radiogroup>

</canvas>

guyr
06-17-2007, 08:46 PM
Works (of course!) - thanks. Senshi, where are you finding all these tidbits that make working with OpenLaszlo so much more productive? I'm feeling like there is a "secrets of OpenLaszlo" book that I haven't discovered.