################################################################################ # Usage: &support_image_buttons # Bill@Explosivo.com # This function should be called after the &read_and_parse_form_data function # is called. It will alter any incoming graphics buttons so the rest of the script # will handle them like normal form buttons # In this order, the subroutine should # 1. Check all incoming form_data keys for an 'x' extention # 2. For each .x button, it removes all non .x buttons # Note: They must end in "button" for this to work # 3. It then removes the .x from the submitted graphical button # sub support_image_buttons { local $eachkey; local $graphicbuttons = 0; # Check all keys to see if an button.x was submitted foreach $eachkey (keys (%form_data)) { if ($eachkey =~ /button\.x$/) { $graphicbuttons = 1; last; } } #End foreach $eachkey # If we found graphic buttons, remove all the other ones _button # if not the rest of the sub is skipped if ($graphicbuttons) { foreach $eachkey (keys (%form_data)) { if ($eachkey =~ /button$/) { delete $form_data{$eachkey}; } } # Now rename .x buttons to buttons so they will be recognized foreach $eachkey (keys (%form_data)) { if ($eachkey =~ /(.*)\.x/) { #Yes it has a .x extention - add it $form_data{$1} = $form_data{$eachkey}; } } } return; }