Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 18962
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: HTML::Form - cannot set anything but the first value in a multi-select field
The attached test demonstrates the problem. I cannot set the value on a select-multiple form to anything but the first value. This only effects <select multiple> and not <select>. I'm taking a stab at a fix but I'm not optimistic. Additionally, it would be nice if the value check did not die. In fact, I'd prefer if it was optional or just went away. There's nothing which says I must send only the values offered in the form and limiting HTML::Form users (and thus WWW::Mechanize) that way limits the possible form hacking one can do.
Subject: html_form.t
#!/usr/bin/perl -w use HTML::Form; my $form = HTML::Form->parse(<<'HTML', "http://www.example.com/"); <form action="foo.thing"> <select name="chanId"> <option value="130" selected>Anime Network</option> <option value="119" >COM 250</option> </select> </form> HTML $form->value('chanId', 130); $form->value('chanId', 119); $form = HTML::Form->parse(<<'HTML', "http://www.example.com/"); <form action="foo.thing"> <select name="chanId" MULTIPLE> <option value="130" selected>Anime Network</option> <option value="119" >COM 250</option> </select> </form> HTML $form->value('chanId', 130); $form->value('chanId', 119); 1;
value() does not work but param() does. param() takes the trouble to go through each possible input. Here's an updated test.
#!/usr/bin/perl -w use HTML::Form; my $form = HTML::Form->parse(<<'HTML', "http://www.example.com/"); <form action="foo.thing"> <select name="chanId"> <option value="130" selected>Anime Network</option> <option value="119" >COM 250</option> </select> </form> HTML $form->param('chanId', 130, 119); $form->value('chanId', 130); $form->value('chanId', 119); $form = HTML::Form->parse(<<'HTML', "http://www.example.com/"); <form action="foo.thing"> <select name="chanId" MULTIPLE> <option value="130" selected>Anime Network</option> <option value="119" >COM 250</option> </select> </form> HTML $form->param('chanId', 130, 119); $form->value('chanId', 130); $form->value('chanId', 119); 1;
Just adding to the point of the about the needlessness of the checking of the possible values. A very practical case for not checking the values is testing some web application using HTML::Form against various user input.
migrated queue: libwww-perl -> WWW-Mechanize