[Kss-devel] Weird behaviour with kssSubmitForm and empty selects
Martin Aspeli
optilude at gmx.net
Thu Oct 4 01:06:40 CEST 2007
Hi,
I have this TAL in oi.plum:
<select size="1" name="stream" id="addDeliverableStream">
<option
value=""
i18n:translate="stream_select_header"
style="font-weight: bold; border-bottom:
solid black 1px;"
>Stream</option>
<option tal:repeat="stream view/streams"
tal:content="stream/title"
tal:attributes="value stream/cmf_uid;
selected
python:request.get('stream', None) == stream.cmf_uid() and 'selected' or
None"
/>
</select>
That first <option /> is a "label" (no space for an actual label) that
submits an empty string. You're meant to pick something else in the list.
This works fine with the non-KSS form handler, which gets
self.request.form['stream'] == "".
I then have this KSS:
#addDeliverableButton:click {
evt-click-preventdefault: true;
action-server: addNewDeliverable;
addNewDeliverable-kssSubmitForm: currentForm();
}
In the addNewDeliverable action, I get self.request.form['stream'] ==
'Stream'. It works fine if I select a value, but when the value is "",
it seems I get the select *label* and not the value.
I suspect there's some code like:
if not value:
value = label
but ... that's wrong. ;-)
Or no?
Martin
--
Acquisition is a jealous mistress
More information about the Kss-devel
mailing list