Hey All --
Regarding image buttons, I'm an advocate of using light-weight Javascript
for this purpose:
<a href="javascript:submit_rm_one()"><img src="rm_one.gif"></a>
This is, to me, the most simple, reliable way of having multiple image
buttons to submit from a single form to multiple run-modes.
> No, unfortunately you can't. When an image submit button is
> used the 'value'
> attribute is not passed with the form parameters. What you
> get out of the
> image button is a 'rm.x=29' and 'rm.y=47', the numbers being
> the pixels
> where the user clicked from left and top of the image.
If you are adverse to Javascript (and I know a couple of you are!), there is
a way you could use these "X/Y" coordinate behaviors. It's a bit of a Rube
Goldberg machine. I would never do it, unless there was an absolute reason
never to use Javascript -- but it ought to work.
One solution is to make use of the ability built in to CGI::Application to
supply a subref to mode_param(). Your subref would point to a function
which looks at the image-submit form data and translates it into the name of
a run-mode.
For example, this HTML:
<form>
<input type="image" name="mode1" src="/images/mode1.gif">
<input type="image" name="mode2" src="/images/mode2.gif">
</form>
...Would be handled by the following CGI-App code:
sub setup {
my $self = shift;
$self->mode_param(\&figure_out_rm_from_image_submit);
$self->run_modes(
# ...Define run-modes as you usually would
);
}
sub figure_out_rm_from_image_submit {
my $self = shift;
my $q = $self->query();
my @params = $q->param();
foreach my $p (@params) {
$p =~ /^(\S+)\.x$/;
return $1 if (defined($1));
}
}
(Note: I've not even remotely tested this code!)
This would allow you to have all your buttons as image-submits. Naturally,
you'd have to add additional code to support anything else, but this would
get you in the ball-park.
TTYL,
-Jesse-
Jesse Erlbaum, CTO
Vanguard Media
http://www.vm.com
212.242.5317 x115
[EMAIL PROTECTED]
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]