HTML::Form, Multiple select Elements with Same name

From: David Marshall (marshall_at_chezmarshall.com)
Date: 07/30/04


Date: Fri, 30 Jul 2004 14:48:49 -0700

Hi all,

I have a form that has multiple <select> elements that have the same
name. This is so that the destination script can deal with all of them
as an array. <select multiple> is not appropriate because the order in
which options are chosen is significant.

A simple version of the form might be

<form action="foo.pl" method="POST">
<select name="m">
<option>a
<option>b
<option>c
</select>
<select name="m>
<option>a
<option>b
<option>c
</select>
<input type="submit">
</form>

Works great. The handler script works wonderfully.

However, when I try to test it all with WWW::Mechanize, there's a
problem with HTML::Form, which parses it out to be (effectively) a
single select with 6 options.

I don't see anyway to make HTML/Form.pm parse this correctly without one
of several really unpleasant modifications. I don't want to have to
change the names of the <select> elements to be unique (e.g. m1, m2),
because then I'd have to add code to the handler script to put these
parameters into an array. I get that effect automatically with the
current naming.

Comments/thoughts/suggestions?



Relevant Pages

  • Re: One other related Q Re: basic Q: Only one way to make vars live outside of the scope of a functi
    ... >>> directly to the calling script, without having to use global variables ... to get multiple return items from a subprocedure. ... >>> better not to mix scope and use global variables for multiple return ... before terminating the object reference. ...
    (microsoft.public.scripting.vbscript)
  • Re: Can you have a command line arg with a workbook?
    ... "Patrick Molloy" wrote: ... but I guess I would still need the multiple IF statements (or ... Case if that works in VBScript?) ... this script starts a new instance of Excel. ...
    (microsoft.public.excel.programming)
  • Re: Pattern for foo tool <-> API <-> shell|GUI
    ... The user can execute a Python script in the shell, ... There are multiple command ... where the command-line handler might look something like:: ... documentation of generate-- and any other methods that accept handler ...
    (comp.lang.python)
  • Re: shell script
    ... |> i need a shell script that can create multiple users.... ... If you setup 1000 users with this, and I want to steal some accounts, all I need to do is login to my account, cat /etc/passwd then login to some of the other accounts that have yet to be 'activated' and change the passwords myself. ... You could probably write a wrapper script or a script to generate /etc/shadow and /etc/passwd entries and depending on how you wanted your users grouped, /etc/group entries as well and then create thir home directory, chown it to the newly created user and copy the contents of /etc/skel to the new home directory, chowning it in the process. ...
    (RedHat)
  • Re: USB microscopes for very small SMT
    ... multiple copies of all your tools? ... I was somewhere and needed a file, a script actually, and it was on ... Just used the GPRS modem to connect to my home server, ...
    (sci.electronics.design)