×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Submit problems

Submit problems

Submit problems

(OP)
Hello,
I am working with a perl program that has a form with a Submit button for performing a search. The button is a image file, and works correctly as shown in the section of code below:
------------
print $query->image_button(-name=>'search',
-src=>'http://myserver.com/search.gif',
-border=>0);
------------
I would like to remove the image button, and use a regular Submit button, so that a user can simply hit 'Enter' to perform a search instead of physically having to click on the image. I have tried the following code:
-----------
print $query ->submit (-name=> 'search',
-value=>'Submit');
-----------
which ~appears~ to work fine, but never returns any results.
Everything I try seems to work OK, but nothing produces search results (or errors)...except using the button_image. I can't understand what is wrong with my script were I can't eliminate that graphic and still have the same functionality?

Any and all advice on this is greatly appreciated!
TIA!
-Jim

RE: Submit problems

It appears you're using CGI.pm......
My read on the CGI.pm documentation is that image buttons created with CGI.pm create parameters named for the x and y coordinates of the point clicked within a button.  So, it follows that your code must be using those coordinates to indicate an image click.  If your image was named 'search', then a click on that image would create two params, search.x and search.y.  So, you would be looking for where your code pays attention to these.  Replacing the graphic with a button will make the 'search.x' and 'search.y' params cease to exist completely.  You might be able to name your new button, 'search.x' (might fool the existing code into working, a bad little bit of misdirection for anyone coming after you) or find the place in your code that deals with 'search.x' and/or 'search.y' and rewrite it to look for your submit button.

'hope this helps...




keep the rudder amid ship and beware the odd typo

RE: Submit problems

(OP)
Right on the money goBoating!

But when I examined the code after my new insight, I can find only 1 reference to 'search.x' and _none_ to 'search.y'. The only mention of search.x is at the beginning of the scrip, which is:
---Begin Code Section---
if ( param('search.x') ) {
print $query->header;
print $query ->start_html (
---End Code section---

Do you think I can remove/change that and have everything work properly?
TIA!
-Jim

RE: Submit problems

I'm working (thinking) at some disadvantage ( can't see what you're doing)
but, yes.... ;^)

My guess is that you only see one of the two params ( search.x and search.y) handled because if one exists, the other exists, and the entire question, at that point is existence.  If either exists, then someone clicked that image.

My guess is that you can change the portion you posted to check for the name of your submit button( which was 'search') instead of an image click coordinate......something like....

if ( param('search') )
    {
    print $query->header;
    print $query ->start_html (....





keep the rudder amid ship and beware the odd typo

RE: Submit problems

(OP)
I'm getting there thanks to you!!

I renamed my button 'search.x' as you mentioned earlier, so now I have:
----
print $query->submit(-name=>'search.x',-value=>'submit');
---
which ~is~ working correctly...only thing I can't figure out is why a carrige return won't work. When I click the Submit button now, results are displayed correctly, but if I use the 'Enter' key no results are displayed. Which is really confusing me because I have another script that the 'Enter' works great for and have tried the same syntax with this code, but cannot get it to work, which is the kicker because this all started because the boss wanted the enter key to work, so I assumed that taking out the graphic and replacing with the standard Submit button would do the trick...but maybe not.

If you have any thoughts that would be great, but you have really helped me ALOT and I do appreciate it!
-Jim

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close