From: Steve M <sjmaster@fa...> - 2004-11-18 20:42:41
I'm having trouble setting an option in a multiselect field to be the
default selected option.
The HTML looks something like this:
<option value="Any" selected>Any</option>
The 'value' attributes I think are optional (or I'm not sure what they
do as far as posting the form is concerned), but FormKit puts them
The MultiSelectField has a method addChoice(value, label) where label is
what appears between the opening and closing option tags, but it doesn't
take an attributes dict argument. I've tried using addAttributes and
setDefault on the field, but I think it is being reset somewhere in
_setAttributes method of some base class. Anyway, I can't get it to
Anyone know the best way to set an option to be selected?
Also, a MultiSelectField has a list value if more than one option is
selected, and a string otherwise. Do you think it would be better if it
always returned a list?
Steve M <sjmaster@...> writes:
> I'm having trouble setting an option in a multiselect field to be the
> default selected option.
I am new to Webware, FormKit etc. but I think I can help you out on this
choices = BaseChoiceClasses.ChoiceList()
for f in 'apple banana blueberry kiwi orange strawberry'.split():
See also attached servlet (fruits.py) with full example of a multi-select
Get latest updates about Open Source Projects, Conferences and News.