Thanks Werner for the suggestion.

I created meanwhile a JIRA issue for this: https://issues.apache.org/jira/browse/MYFACES-3460

A global js listener is unfortunately not what I need.
In my case it depends on the form, whether a js should be executed during submission or not. Some requests can run in parallel (e.g. autocompletion, pulls) while others are blocking.

Do you know why the simple onsubmit of a form is not executed for ajax requests?

Michael

Am 06.02.2012 14:02, schrieb Werner Punz:
Hi if you need to execute commands before any arbitrary ajax call
then you can add your own global ajax request listener via
jsf.ajax.addOnEvent(callback)


The callback is called three times per request, same as if you would
set it directly within the request, but on a global scale.

http://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html

Unfortunately a deregistration is not possible within the jsf api within myfaces there is a way but that would break the compatibility of the code with Mojarra.


Werner





Am 02.02.12 11:05, schrieb Michael Heinen:
Hi,

I am currently migrating an application to JSF 2.1

I have a lot of ajax commands (richfaces) and some new f:ajax tags.
My forms contain some js functions which should be called during
onsubmit but unfortunately onsubmit is not called for ajax requests.

How can I specify some JS functions that should be executed before any
ajax call?
I do not want to add them to a few hundred commands manually and would
like to define the calls on a few spots as possible.

Thanks,
Michael





Reply via email to