AbstractWizardController random 'Invalid submit detected'
mands.MyCommand@91d7c[emailAddress=joeuser@mycompany.com] [org..web.servlet.mvc.AbstractFormController.showForm(AbstractFormController.java:564)]
[18:36:59,312 DEBUG MyController] - gt;gt;gt;gt; MyCommand Address is: com.myCompany.service.commands.MyCommand@91d7c[emailAddress=joeuser@mycompany.com] [com.myCompany.web.MyController.referenceData(Unknown Source)]
[18:36:59,312 DEBUG MyController] - Showing wizard page 0 for form bean 'mycommand' [org..web.servlet.mvc.AbstractWizardFormController.showPage(AbstractWizardFormController.java:332)]
[18:36:59,312 DEBUG MyController] - gt;gt;gt;gt; MySet Address is: [com.myCompany.beans.MySet@10e8647, com.myCompany.beans.MySet@98f352] [com.myCompany.web.MyController.referenceData(Unknown Source)]
[18:36:59,312 DEBUG MyController] - Setting page session attribute [com.myCompany.web.MyController.PAGE.mycommand] to: 0 [org..web.servlet.mvc.AbstractWizardFormController.showPage(AbstractWizardFormController.java:340)]
[18:36:59,312 DEBUG MyController] - gt;gt;gt;gt; MySet size: 2 [com.myCompany.web.MyController.referenceData(Unknown Source)]
[18:36:59,328 DEBUG MyController] - Setting form session attribute [com.myCompany.web.MyController.FORM.mycommand] to: com.myCompany.service.commands.MyCommand@1dedb45[emailAddress=lt;nullgt;] [org..web.servlet.mvc.AbstractFormController.showForm(AbstractFormController.java:564)]
[18:36:59,328 DEBUG DispatcherServlet] - Rendering view [org..web.servlet.view.JstlView: name 'page2'; ucl [/WEB-INF/jsp/page2.jsp]] in DispatcherServlet with name 'mycompany' [org..web.servlet.DispatcherServlet.render(DispatcherServlet.java:1158)]
[18:36:59,328 DEBUG MyController] - gt;gt;gt;gt; MyCommand Address is: com.myCompany.service.commands.MyCommand@1dedb45[emailAddress=lt;nullgt;] [com.myCompany.web.MyController.referenceData(Unknown Source)]Well, I figured it out... Turns out it was the onclick javascript attached to my quot;_finishquot; submit button.
I was trying to hide the form from the user after they click submit with the js below. This seems to cause intermittent problems for the wizard controller.
I do not really understand why Spring uses the submit button name to store a value. Admittedly, I don't really understand the javascript aspect of this problem very well, but the submit button seems very unstable and hard to tweak. I've also tried some tricks (with no success) so that when the user hits the lt;entergt; key while in the form they go forward instead of back. It is the default behavior in IE for lt;entergt; to select the first submit button on the form which is typically also the quot;backquot; button for the wizard. It would seem more straight forward to use a hidden input for which you could change the value verses playing with the name of the submit.
Anybody got some good tricks on getting around this?
Code:
function wait() {
var msg = quot;lt;h2gt lease do not click anything while your information is processed.lt;/h2gt;quot;;
lt;%-- hide the form --%gt;
document.getElementById('content').style.display = 'none';
lt;%-- rewrite footer html --%gt;
document.getElementById('footer').innerHTML=msg;
document.forms[0].submit();
}
Code:
lt;input type=quot;submitquot; name=quot;_finishquot; value=quot;Finishquot; onclick=quot;wait();quot; /gt; |