myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Werner Punz (Commented) (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3460) onsubmit of form not executed for ajax commands
Date Mon, 06 Feb 2012 13:48:00 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201282#comment-13201282
] 

Werner Punz commented on MYFACES-3460:
--------------------------------------

Not directly a bug, as I explained in the users list, onsubmit is not performed because no
direct form submit is performed at all. For intercepting ajax calls there is the event listener
interface.
Ajax Double submits can be prevented in myfaces at least with the queue control functionality,
see this article here for further info:
http://www.irian.at/de/blog/-/blogs/apache-myfaces-queue-control

The delay functionality is exactly what can be used for double ajax submit prevention within
a certain timeframe.
outside of that you can use the ajax listener functionality to prevent double submits for
infinite submit time by throwing an error in case of a double submit.


                
> onsubmit of form not executed for ajax commands
> -----------------------------------------------
>
>                 Key: MYFACES-3460
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3460
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.0.8, 2.1.5
>         Environment: Tomcat 6.0.32, Facelets
>            Reporter: Michael Heinen
>
> During the migration from JSF 1.2 to 2.1 I noticed that the onsubmit attribute of forms
is not executed for ajax links.
> Sample:
> <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:ui="http://java.sun.com/jsf/facelets"
>       xmlns:h="http://java.sun.com/jsf/html"
>       xmlns:f="http://java.sun.com/jsf/core">
> <ui:composition>
> <h:form id="myform" onsubmit="alert('submitted')" >
> <h:outputText id="oldCounter" value="oldCounter: #{MyController.counter}"/><br/>
> <h:outputText id="newCounter" value="newCounter: #{MyController.counter}"/><br/>
> <h:commandButton value="AjaxButton" actionListener="#{MyController.increase}" >
> <f:ajax render="newCounter" execute="@this"/>
> </h:commandButton><br/>
> <h:commandButton value="Button" actionListener="#{MyController.increase}"/>
> </h:form>
> </ui:composition>
> </html>
> @ManagedBean(name = "MyController")
> @SessionScoped
> public class MyController{
>   private int counter = 1;
>   public int getCounter() {
>     return counter;
>   }
>   public void increase(ActionEvent ae) {
>     counter++;
>   }
> }
> This is also not working with mojarra 2.1.6 and 2.0.8.
> I used the onsbumit with JSF 1.2 in order to lock the screen and prevent double submits.
> Now I do not see any working alternative in JSF 2.1

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message