You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dave Newton (JIRA)" <ji...@apache.org> on 2008/07/22 02:41:05 UTC

[jira] Commented: (WW-2730) wrongly generated onsubmit attribute in simple theme

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

Dave Newton commented on WW-2730:
---------------------------------

If your own onsubmit handler returns a value then the return provided by the template will never execute.

For example:

onsubmit="return myHandler()"

I agree it should be changed, but unless your JavaScript is broken the superfluous "return true;" should never be an issue.

> 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.