aspose file tools*
The moose likes XML and Related Technologies and the fly likes Problem with image as submit button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem with image as submit button" Watch "Problem with image as submit button" New topic
Author

Problem with image as submit button

Darryl Failla
Ranch Hand

Joined: Oct 16, 2001
Posts: 129
I'm using an image as a submit button in my XSLT file. The tag I'm using is <input type="image" name="submit" src="file path of image" />. The problem I'm having is that upon pressing the button (image), my URL contains X and Y attributes of the image as parameters (submit.x= and submit.y =). While this does not ruin the use, it is ugly.

There must be a way I can avoid posting these parameters in the URL of my servlet call. Anybody know how?


Darryl Failla
Sun Certified Java 2 Programmer
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18564
    
    8

Well, no, you are using XSLT to generate HTML which contains said submit button, isn't that right? Unfortunately I can't tell whether your question is whether the link actually needs those attributes or what. Could you give us some actual examples of the HTML, if that's the problem? Or an example of the XSLT that's generating it, if that's the problem?
Darryl Failla
Ranch Hand

Joined: Oct 16, 2001
Posts: 129
It's really an HTML issue. Every examples I've found of using an image as a submit button does the same thing so I suspect that's just the way it is. I would just like to get rid of those x and y components from my URL if possible. Below is my XSLT excerpt:

<form method="get" action="/container/servlet/ReportLogServlet">
<table cellspacing="2" align="left">
<tr>
<td>View</td>
<td>
<select name="view">
<option value="current" selected="selected">Current Jobs</option>
<option value="past"> Past Jobs </option>
</select>
</td>
<td>
<input type="image" name="submit" src="c:/image.gif" />
</td>
</tr>
</table>
</form>
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18564
    
    8

I must be missing something here. The only strange thing I notice about the URL in that <image> link is that it's pointing to a location on the client's system. What are these x and y components you're asking about?
Darryl Failla
Ranch Hand

Joined: Oct 16, 2001
Posts: 129
Using the code posted above, when the image button is pressed, the generated URL will be something like:

http://serverName/container/servlet/ReportLogServlet?view=current&submit.x=7&submit.y=11

Note the x and y components of the image button named "submit". If you don't give the image button a name, the URL will contain x=7&y=11. The values change and lead me to believe that it has somthing to do with the location of the control on the form.

What I'd like to do is not have that useless information show up in my URL at all.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18564
    
    8

It took me a while to duplicate your complaint, because I don't normally use Internet Explorer as my browser. But when I changed the HTML to use a proper URL (not just a file path) in the <input src=""> attribute, I found that Firefox does the same thing. So then I wasn't too surprised to find this in the HTML 4.01 recommendation:

When a pointing device is used to click on the image, the form is submitted and the click coordinates passed to the server. The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image. The submitted data includes name.x=x-value and name.y=y-value where "name" is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with image as submit button