[Seaside] Re: WASelectTag - html select question

Louis LaBrunda Lou at Keystone-Software.com
Mon Mar 23 18:43:44 UTC 2009

Hi Lukas,

Thank you very much for the reply.

>> I'm new to both Seaside and html so this may be a dumb question but here
>> goes.  It seems that when one wants an html "select" (that will return the
>> selected item) and the list is a collection of Associations, the "value"
>> part of the "option" is generated by Seaside and the displayed list item is
>> the #value of the Association.  It would be nice if the "value" part of the
>> "option" was the #key of the Association.

>Seaside takes care of the value attribute of option tags, similar as
>it does with all other names on a page. This is to ensure uniqueness,
>even if different components or multiple instances of the same
>component are displayed at once.

Yes, I see that Seaside is taking care of the values/names of the option
tags.  And, I do need to know which option was selected.  But, it seems to
me that only one name needs to be generated by Seaside for the select tag
so that the selected option (value part of option) can be returned.  It
seems the value attribute of option tags is being used by Seaside as a name
to return the selected option.

This may have more to do with what web browsers return than what Seaside
wants, I don't know?  I do realize that the options sent by Seaside don't
have to be Associations (although they match up nicely) and that may have a
lot to do with why Seaside always makes up values instead of sometimes
making them up and sometimes using the key of an Association.

>If you really want to specify your own names/values and if you don't
>need the Seaside callbacks on these elements, feel free to run your
>own rendering along the following lines:

>html select: [
>   aDictionary keysAndVauesDo: [ :key :value |
>       html option
>           value: key;
>           with: value ] ]
>Generally it is a better idea to use CSS classes to identify different
>kind of DOM elements from Javascript.

Thanks, Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com

More information about the seaside mailing list