in reply to WWW::Mechanize form field types

I'm sure you'll find answer in HTML::Form documentation.

$input->type Returns the type of this input. The type is one of the following strin +gs: "text", "password", "hidden", "textarea", "file", "image", "submi +t", "radio", "checkbox" or "option".

Replies are listed 'Best First'.
Re^2: WWW::Mechanize form field types
by Lawliet (Curate) on Jun 30, 2008 at 04:31 UTC
    Ah yes, that is exactly what I was looking for =D I guess I'll reply to this if there is any more trouble. Thanks.


    EDIT: It is outputting the same thing =(

    Am I doing something wrong?

    Here is my code relevant to the issue:
    use strict; use WWW::Mechanize; use HTML::Form; use LWP::UserAgent; my $url = "a valid url to an .aspx form here"; my $mech = WWW::Mechanize->new(autocheck => 1); $mech->get( $url ) or die("Could not connect to $url"); my $ua = LWP::UserAgent->new; my $response = $ua->get($url); my @forms = HTML::Form->parse($response); foreach my $page (1..15) { foreach my $form (@forms) { my @fields = ""; @fields = $form->inputs; foreach my $hurr (0..$#fields) { print "$fields[$hurr]\t $page / 15\n"; } } }

      As i see you don't read docs :-(

      foreach my $form (@forms) { my @fields = $form->inputs; foreach my $input (@fields) { print $input->type() . "\t $page / 15\n"; } }
        There is a difference between reading and comprehending ;)

        I don't have time right now (and might not for a week) to further look into the problem, but thanks for your help (if what you provided helps).

        It works =D
        Thanks for helping out.
Re^2: WWW::Mechanize form field types
by Anonymous Monk on Jun 30, 2008 at 06:31 UTC
    Don't use pre tags, use code tags.

      Thanks for your above post, it is useful for me. However I'm not able to find any form on my page. I used all form options available with www::mechanize. The page is jsp page and the only form tag available in source code is as mentioned below.

      <form action="html" method="post"> <input type="submit" name="clearAllCaches" value="Clear Al +l Caches" style="margin:1em;" /> </form>