Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: two submit buttons in a form

by Masem (Monsignor)
on Mar 12, 2001 at 08:53 UTC ( [id://63748]=note: print w/replies, xml ) Need Help??


in reply to Re: two submit buttons in a form
in thread two submit buttons in a form

I'm not sure if this is expected behavior, or a cavaet, or something else... when I do this (two submits on the same page) using the same NAME parameter, I get back from CGI with that name parameter an array, which only has one elements, that being the VALUE of the submit button that was hit. It's easy enough to check to see if what CGI returns is an array or not, but it seems odd and undocumented. The only thing that might be affecting this is that I use short phrases for the VALUEs, so the multiplicity of words might be causing this, but seems doubtful.
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re: Re: Re: two submit buttons in a form
by sutch (Curate) on Mar 12, 2001 at 20:34 UTC
    The only way that I can duplicate this behavior is to request the value(s) of the parameter in list context:

    my @value = $q->param("bloption");

    Otherwise, CGI.pm returns a scalar with the value of bloption. Examining the URL of the submitted form (that contains the two submit buttons), I can see that only one value for bloption is actually being submitted:

    http://localhost/~sutch/test/index.cgi?bloption=add

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://63748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 11:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found