On Nov 15, 6:52 pm, [EMAIL PROTECTED] (newBee) wrote:
> I have the fallowing html code, and in this code segment i want to
> fill the field but the problem is instead of name the field as <field
> name"blabla"/> they use the <input id="blabla"/> tag.
> It will be a great help if someone could guide me on this...

id is not a substitute for name.  The name attribute is required on
all input tags other than submit and reset. (http://www.w3.org/TR/
html401/interact/forms.html#h-17.4)  If you pass invalid HTML to the
module, of course it's not going to do what you want.

Fix the HTML.  If you don't have permissions to fix the HTML, contact
the person who does.

Alternatively, you can try retrieving a list of all the inputs and
looping through them to see which one has the right id.  Something
along these lines (untested):

my @inputs = $mech->current_form()->inputs();
for my $input (@inputs) {
    if ($input->{id} eq 'blablah') {
         $input->{value} = "whatever";
    }
}
__END__

Frankly, I have no idea if that would do the right thing when you
later try to submit the form.

I stand by my original recommendation - fix the HTML.

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to