Problem with HTML::Form and several fields of same name

Discussion in 'Perl Misc' started by Andreas Grothey, Feb 1, 2005.

  1. Hello,

    I'm fairly new to Perl, so excuse me if I've missed something obvious.

    It seems to me that HTML:Form doesn't work correctly if a Form has
    several "select" fields of the same name.

    This is what I am trying to do:

    I'm taking part in Yahoo's Football Manager game (so this is all for
    fun, but the excuse is that I'm trying to learn Perl this way). This
    game requires a lot of tedious clicking through forms and pages, so I
    thought I'd automate a lot of it using WWW::Mechanize. One of the
    pages (to choose where to play which player) has a lot of "select"
    fields on it, quite a few of them with repeated name (i.e. 3 named
    'sturm' (=forward) if you play with 3 forwards and so on). The page is, you have to
    be registered in the game to view it though.

    From looking through WWW::Mechanize I thought that something like

    form_number => 1,
    fields => {
    sturm => [8, 2],

    would set the second 'sturm' field to 8 (i.e player number 8).
    However Perl complains that it cannot find a second field of that

    I've spend quite a lot of time looking through WWW::Mechanize and
    HTML::Form (which is called from it), and I think the problem is that
    HTML::Form simply doesn't treat 'select' fields correctly: if it finds
    an 'option' tag in a 'select' field it goes and looks whether it
    already knows a 'select' of this name and appends the option. The
    possibility that this might be a second select of the same name
    doesn't seem to be tested for. The information from a closing /select
    is ignored. I've actually hacked in HTML::Form adding a counter to
    distiguish between different "select"s and it seems to be working for
    me now.
    Although as I'm fairly new to Perl, I've probably broken something
    somewhere else.

    So have I missed something obvious in how to use HTML::Form or
    WWW::Mechanize, or have I found a bug?

    Any thought?


    PS: I'm using Perl 5.8.6, HTML::Form v1.49 and WWW::Mechanize v1.06
    which are the newest I could find
    Andreas Grothey, Feb 1, 2005
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xif
    Steven Bethard
    Mar 9, 2005
  2. Replies:
  3. Rizyak
    Jun 11, 2004
  4. Pavils Jurjans
    Pavils Jurjans
    Mar 18, 2005
  5. Replies:

Share This Page