[ 
https://issues.apache.org/struts/browse/WW-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44452#action_44452
 ] 

Gabriel Belingueres commented on WW-2730:
-----------------------------------------

Exactly.

The superfluous "return true;" do not hurt I think, just in case, it remains to 
be tested how it behaves in browsers with javascript disabled or browsers with 
no javascript support (lynx?)

> wrongly generated <s:form> onsubmit attribute in simple theme
> -------------------------------------------------------------
>
>                 Key: WW-2730
>                 URL: https://issues.apache.org/struts/browse/WW-2730
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.1.2
>         Environment: Tomcat 5.5.26, WinXP
>            Reporter: Gabriel Belingueres
>            Priority: Minor
>
> Hi,
> In the simple theme, the form.ftl file render the form onsubmit attribute 
> like this:
>       <#if parameters.onsubmit?exists><#rt/>
>               ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return 
> true;") }
>       <#else>
>               ${tag.addParameter('onsubmit', "return true;") }        
>       </#if>
> The problem with this is that the "return true" forces to always submit the 
> form, which prevents (me) from executing some custom javascript validations 
> to check if the form can be submitted or not.
> Even the <else> part of the script seems superfluous because not rendering 
> the onsubmit attribute will submit the form anyway.
> The following code seems to solve the problem:
>       <#if parameters.onsubmit?exists><#rt/>
>               ${tag.addParameter('onsubmit', "${parameters.onsubmit};") }
>       </#if>
> Tested the patch with both "simple" and "xhtml" themes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to