Andy Lester wrote:

On May 16, 2007, at 3:46 PM, Peteris Krumins [Newsgroups] wrote:

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 ..."


Can you give a specific code snippet that fails? It would let me make a test out of it, and make everything clear to all reading (including me).


I am writing a script which will automatize form submission on some websites. There is a video sharing website www.bolt.com which has a registration form with two elements named 'signupMe' - a text field and checkbox. The text field has default value "false" and the checkbox has a default value "on".

Here it is an example which will cause Mech to die:

#!/usr/bin/perl

use strict;
use warnings;

use WWW::Mechanize;

my $mech = WWW::Mechanize->new;

$mech->get('http://www.bolt.com/registration/index.bt');
$mech->submit_form(
   with_fields =>  {
       signupMe    =>  "on",
       signupMe    =>  "false",
   }
);


I'd like Mech not to die and rather figure out which value belongs to which type of field (text field or checkbox) and just
submit both of them in order they appear in the form as FireFox does.


P.Krumins

Reply via email to