Hey there, I'm having some issues in filling out a form on a webpage with WWW::Mechanize that contains disabled fields.
bash-3.2$ mech-dump --forms "http://www.carzone.ie/usedcars/" GET http://www.carzone.ie/usedcars/index.cfm [form1] fuseaction=search (hidden readonly) MakeID= (option disabled) [*/Any Make] xMakeID= (hidden readonly)
My problem is the disabled fields, they seem to be generated by javascript unlike the others. I've searched around and I found someone who had a similar problem, they suggested using HTML::Form::ForceValue. So here is my code ...
use strict; use warnings; use WWW::Mechanize; use HTML::Form::ForceValue; my $m = WWW::Mechanize->new( autocheck => 1 ); $m->agent_alias( 'Windows IE 6' ); $m->get("http://www.carzone.ie/"); $m->follow_link( url_regex => qr/Used/i ); $m->set_fields( #MakeID => '32', #ModelID => '281', #CountyID => '10', xMakeID => '32', ); $m->form_name("form1")->find_input("MakeID")->force_value("32"); $m->form_name("form1")->dump;
And the output is the following:
GET http://www.carzone.ie/usedcars/index.cfm [form1] fuseaction=search (hidden readonly) MakeID=32 (option disabled) [:/Any Make|*32] xMakeID=32 (hidden readonly)
So it looks like it is setting the desired value, but the output is using 'Any Make', which suggests the forced value is being ignored. I'm pretty knew to this as a whole, so i'm not sure where to go from here. Any tips/advice would be greatly appreciated, thanks in advance.

In reply to WWW::Mechanize and disabled form field by goldfish_

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.