which in turn creates the following HTML code that www::mechanize uses
to test the code.
this makes the cat field an array. the problem is that when I try to
use www::mechanize to submit values to this filed I get the following
error:
Illegal value '211' for field 'cat[]' at /path.pl line 89
Does anyone know how I can submit values to an array based form field?
Re: Can"t use www::mechanize with an array form field
am 06.12.2004 15:02:14 von gisle
Tim writes:
> I have a website written in PHP/MySQL.
>
> I'm using www::mechanize and www::mechanize::formfiller to test the site.
>
> I declare one of the form fields as an array in PHP like so:
>
> echo "
> value=\"$cat_id\">".VarPrepForDisplay($title)."";
>
> which in turn creates the following HTML code that www::mechanize uses
> to test the code.
>
>
>
>
> this makes the cat field an array. the problem is that when I try to
> use www::mechanize to submit values to this filed I get the following
> error:
>
> Illegal value '211' for field 'cat[]' at /path.pl line 89
>
> Does anyone know how I can submit values to an array based form field?
I don't know what it takes in WWW::Mechanize land, but if you have
access to the HTML::Form object you can do this:
$form->param("cat[]", 211, 213);
This will turn on the "211" and "213" check box and all the other
"cat[]" checkboxes off.
Regards,
Gisle
Re: Can"t use www::mechanize with an array form field
am 06.12.2004 16:11:27 von Andy
On Mon, Dec 06, 2004 at 06:02:14AM -0800, Gisle Aas (gisle@ActiveState.com) wrote:
> > Illegal value '211' for field 'cat[]' at /path.pl line 89
Is there actually a cat[] field that has a value of 211? Or are you
trying to fudge an existing field to have a value that it didn't
originally?
xoa
--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance
Re: Can"t use www::mechanize with an array form field
am 16.12.2004 03:51:04 von tim.binary
>
> Is there actually a cat[] field that has a value of 211? Or are you
> trying to fudge an existing field to have a value that it didn't
> originally?
>
No the value '211' is valid. When I switch the form code back to a
single value - for example without declaring the field as an array as
follows then my
www::mechanize code works fine. So I know it's because of the array
field declaration.
Thanks for the HTML::Form suggestion - I'll try that.