You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Gabriel Belingueres (JIRA)" <ji...@apache.org> on 2008/07/21 23:26:06 UTC

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

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.


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

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Gabriel Belingueres (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-2730.
---------------------------------

    Resolution: Fixed

fixed on trunk, "return true" removed from template and tests

> 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: Trivial
>             Fix For: 2.1.3
>
>
> 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.


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

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Newton updated WW-2730:
----------------------------

    Priority: Trivial  (was: Minor)

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


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

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2730:
-----------------------------

    Fix Version/s: 2.1.3

> 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: Trivial
>             Fix For: 2.1.3
>
>
> 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.


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

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44453#action_44453 ] 

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

If JavaScript is disabled or the browser doesn't support JavaScript it will be ignored (by definition).

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