Submitting a form with two identically named fields using WWW::Mech

"Peteris Krumins [Newsgroups]" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Hello!

I was programming some web automation stuff using Mech and found the 
following.
Suppose someone not too skillful at designing HTML forms had made a form 
with two elements,
a checkbox and a text field, and both assigned the same name 'element_name'.

Now if I call Mech's submit_form() and specify both fields, the Mech 
would die with the following error:
"Illegal value 'false' for field 'element_name' at Mechanize.pm line ..."

This error originates in HTML::Form which apparently checks if the form 
element's type matches the element's value.

It doesn't seem right that Mech will die just because of someone 
specifying two fields with the same name.

For example, Mech could figure out which value belongs to which field 
and then submit both of them in order they appear in the form.
(This is what FireFox does if a form has two fields with the same name, 
and then it's up to server side to decide which value to use)


Thanks,
P.Krumins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.