Current location: Hot Scripts Forums » Programming Languages » Perl » processing multiple "image" type submit buttons


processing multiple "image" type submit buttons

Reply
  #1 (permalink)  
Old 07-21-04, 02:03 PM
baparao baparao is offline
New Member
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
processing multiple "image" type submit buttons

Hello friends.

I am looking for a good way in perl scripts to process a form that has multiple submit buttons in the form of imge type inputs
for example,
(<input name="submit1" type="image" src="foo.jpg">
(<input name="submit2" type="image" src="bar.jpg">

The w3c documentation at
http://www.w3.org/TR/html401/interac...tml#edef-INPUT

says that the clicked image x and y coordinates are transmitted via CGI along with the image name, implying that the script would identify which of the multiple submit buttons was clicked by checking the x-y coordinates.

Is there an easier way to do this? I would appreciate any information/knowledge that you can share.

thanks,
Bapa
Reply With Quote
  #2 (permalink)  
Old 07-30-04, 11:56 PM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
Using CGI.pm your images buttons are going to be coming though as either submit1.x and submit1.y OR submit2.x and submit2.y where the values of those params will give you the x,y values of the mouse press on that button. All you need to do is check your CGI object for the existance of a param with a .x or .y to see what button was pressed:

Code:
use CGI;
my $q = CGI->new;

my ($pressed) = grep { /^.*\.x$/; s/\.x$//; } $in->param;

# Do something with $pressed
I tested for foo.x then stripped off the .x and set that value in $pressed.

~Charlie
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting multiple rows using radio buttons and text ciggie PHP 2 03-19-04 07:46 PM
3 submit buttons, I want one of them to be used when hitting enter. blasto333 HTML/XHTML/XML 2 02-21-04 03:24 PM


All times are GMT -5. The time now is 03:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.