• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form submission problem in some browsers, using struts tag in form

 
Priyanshu Chauhan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm using struts tag in my JSP page for form submission. I'm using two images for boolean input from the user (image names are YES and NO).
So there is no submit button in the page because the form get submitted as soon as user clicks any of the two images.
This JSP page is only working properly in the Google Chrome whereas Clicking the images 'Yes' or 'No' on Mozilla,IE etc form doesn't get submitted to the Structs action (hence no change in my database).

Here is the JSP:




 
jatan bhavsar
Ranch Hand
Posts: 299
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Priyanshu,

How it automatically submits the form once you click on the image? Are you using any script to submit the form?


Regards
Jatan
 
Priyanshu Chauhan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the struts tag <h: image> itself act as the submit button.
So no script is required for autosubmission of form.

And i found the answer myself.
since the <h: image> act as a image version of submit button therefore i use two <h: form> and the property in hidden form tag
i.e <h: hidden property=" ">

I don't know if this the best way to submit form using images but this is working for me.





<h:form action="/VoteAction" method="post">
<h: hidden property= "vote" value="true">
<h:image "images/logo/yes.png"></h:image>
</h:form>

<h:form action="/VoteAction" method="post">
<h: hidden property= "vote" value="false">
<h:image "images/logo/NO.png"></h:image>
</h:form>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic