PeterB
unread,Sep 29, 2011, 5:17:25 PM9/29/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to twill-dev
Hi all,
I have a simple case of something like this on a page I'm testing with
Twill
<form...>
...
<select name="aSelect" id="aSelect">
<option value=""></option>
<option value="33">a value</option>
<option value="54">another value</option>
...
If I call the submit method, aSelect will be given a GET/POST value of
"33" by default however, since the first entry listed is actually
empty, I don't want anything sent unless I actually set it myself.
Showform for this control confirms that the first line is skipped:
...
9 aSelect select aSelect ['33'] of ['33', '54',
'51', '18', ' ...
...
Looking through the debugger, HTML parser doesn't seem to even provide
it to _mechanize if there's no content in the tag.
As a workaround, I thought to explicitly try to set the value of
aSelect to empty string or None with set_form_control_value but this
throws the ClientForm.AmbiguityError (multiple matches to value/label
"" in list control) to since there is no value for this "empty" entry
in the control.
Browsers seem to be able to skip setting the control on submit
requests if there is no value but I'm stumped how to get the same
behaviour in Twill when I can't modify the underlying HTML to include
anything in the body of the option tag.
Anything else I can try?
PeterB