Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit problems

Status
Not open for further replies.

yim11

MIS
Jun 26, 2000
35
US
Hello,<br>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:<br>------------<br>print $query-&gt;image_button(-name=&gt;'search',<br>-src=&gt;'<A HREF=" TARGET="_new"> 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:<br>-----------<br>print $query -&gt;submit (-name=&gt; 'search',<br>-value=&gt;'Submit');<br>-----------<br>which ~appears~ to work fine, but never returns any results.<br>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?<br><br>Any and all advice on this is greatly appreciated!<br>TIA!<br>-Jim
 
It appears you're using CGI.pm......<br>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.&nbsp;&nbsp;So, it follows that your code must be using those coordinates to indicate an image click.&nbsp;&nbsp;If your image was named 'search', then a click on that image would create two params, search.x and search.y.&nbsp;&nbsp;So, you would be looking for where your code pays attention to these.&nbsp;&nbsp;Replacing the graphic with a button will make the 'search.x' and 'search.y' params cease to exist completely.&nbsp;&nbsp;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.<br><br>'hope this helps... <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
 
Right on the money goBoating!<br><br>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:<br>---Begin Code Section---<br>if ( param('search.x') ) {<br>print $query-&gt;header;<br>print $query -&gt;start_html (<br>---End Code section---<br><br>Do you think I can remove/change that and have everything work properly? <br>TIA!<br>-Jim
 
I'm working (thinking) at some disadvantage ( can't see what you're doing) <br>but, yes.... ;^)<br><br>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.&nbsp;&nbsp;If either exists, then someone clicked that image.<br><br>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....<br><FONT FACE=monospace><br>if ( param('<font color=red>search</font>') ) <br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;print $query-&gt;header;<br>&nbsp;&nbsp;&nbsp;&nbsp;print $query -&gt;start_html (....<br></font><br><br> <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
 
I'm getting there thanks to you!!<br><br>I renamed my button 'search.x' as you mentioned earlier, so now I have:<br>----<br>print $query-&gt;submit(-name=&gt;'search.x',-value=&gt;'submit');<br>---<br>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.<br><br>If you have any thoughts that would be great, but you have really helped me ALOT and I do appreciate it!<br>-Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top