(no attachments for libwww) On Dec 7, 2007 9:26 AM, maltejoos wrote: > Hi, > > I'am using www::mechanize, and I want to set multiple "select" fields > with the same name to the same value. Because the select() function > don't accepts a "number" argument, I do not know how to handle this issue. > Searching in google, I found this: > http://www.issociate.de/board/post/439148/Mechanize_and_form-%3Eparam().html > > I think, this is the same problem I have, isn't it? > So I'm wondering whether you could send your fixed Form.pm to me? > > In addition I want to know what it does exactly. So, what is the > difference from calling the original form->param() function instead of > yours? > Does it set all options to the same value automatically? Or how does it > work? > > Thanks a lot and greetings from Germany > > Malte >
Hi Malte - I am attaching my version of Form.pm and a file with the diff of my version and the currently released one. Yes, you are having the same problem that my patch fixes. My change alters the way Form.pm handles parsing of "select" tags. It enables there to be multiple select tags with the same name. The old From.pm would create only one select per name per form and then combine all options from selects with the same name into that one select. My patch creates multiple selects for each select tag even when they have the same name. Since select() is defined in WWW::Mechanize.pm and that sub is built based on the released version of From.pm it does not handle multiple selects with the same name. However when using the new Form.pm you could use Mech's field() to set the specific select to a particular value, like so: $mech->field( $name, $value, $index ); Changes to WWW::Mechanize.pm to handle multiple selects would not be hard to make but then it would assume a Form.pm that handled them properly. Calling form->param() should function as expected. Let me know if does not. -- -----Alex