CheckBoxTable Widget

1 view
Skip to first unread message

BluePoint

unread,
Sep 12, 2008, 2:09:01 PM9/12/08
to ToscaWidgets-discuss
One can check particular boxes in a CheckBoxTable at display time by
passing it a list containing the names of the options to check.
However, when the form is submitted, all that seems to come back is
the name of the first option to be checked, any other checked options
being ignored. This is clearly not what is needed.

I have a solution which involves modifying the template to decorate
the name parameter of each option with its index, so that when the
form is posted, each option sends back its own keyword/value pair
which can be decoded into some composite value.

Others must have experienced this problem, so, has anyone a reaally
neat solution?

BluePoint

unread,
Oct 1, 2008, 2:40:58 PM10/1/08
to ToscaWidgets-discuss
Nobody has responded to my post below, perhaps because I didn't
explain the problem clearly enough, but unless I've misundferstood
something, it's a serious problem, so I'll try again.

I have a form with a CheckBoxTable called 'Days' containing four
items, with the values 'Thu', 'Fri', 'Sat' and 'Sun'.
In the html, the four input fields have the same name value 'Days'.
In my TG2 app, I pass in a value Days of say ['Fri','Sun'] and the Fri
and Sun fields are checked as expected, so it's working correctly in
that direction. When I submit the form, and look for kw['Days'], I get
a string containing just the first checked value, even if there are
other values checked.
If I change the form method to GET, the url contains all the checked
values, e.g. Days=Fri&Days=Sun
I have not been able to check directly what comes back when the method
is POST, so I'm not sure whether the problem lies with the POST method
as such or whether Pylons is not passing on everything the form submit
is generating.

If the behaviour I have described is standard, it rather detracts from
the usefulness of the CheckBoxTable. Also a quick play with a
MultipleSelectionField suggests that the same problem exists there, in
that one gets only one of the selected options. If I am just missing
the point somewhere, I'd be very grateful if someone would point out
how to fix it.
Reply all
Reply to author
Forward
0 new messages