-
1. Re: eventqueue and confirm box in onsubmit()
nbelaevski Nov 3, 2008 6:19 PM (in response to ronanker)Hello,
Yes, I've already seen the problem on 3.2.2. You're right - the problem is caused by request not being cleared. We're redesigning queues feature right now so the problem will be fixed in 3.3.0. There's no known workaround; looks like the only way to fix that is to patch JSFAJAX.js script: http://fisheye.jboss.org/browse/RichFaces/trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js?r=10604 - the bug is in A4J.AJAX.Submit method. Or you can override it by:A4J.AJAX.Submit = function(){ ... }
in your code -
2. Re: eventqueue and confirm box in onsubmit()
ronanker Nov 4, 2008 12:53 PM (in response to ronanker)Thanks for your reply!
Well the A4J.AJAX.Submit() method is quit big. I'm not sure i want to override it.
I made a fix directly in our onSubmit() method :... if (!confirm(message)){ //Hacking RichFaces : queues should be cleared if onsubmit return false var eventsQueue = A4J.AJAX._eventsQueues['requestQueue']; if( eventsQueue ) { A4J.AJAX._eventsQueues['requestQueue']=false; if(eventsQueue.wait){ LOG.debug("Queue not empty, execute next request in queue "+options.eventsQueue); A4J.AJAX.SubmiteventsQueue(eventsQueue); } } //end hacking return false; } ...
Does it look good for you ? -
3. Re: eventqueue and confirm box in onsubmit()
nbelaevski Nov 4, 2008 1:54 PM (in response to ronanker)Can you please post complete code?
-
4. Re: eventqueue and confirm box in onsubmit()
ronanker Nov 7, 2008 12:08 PM (in response to ronanker)Here it is,
In our JSPs:<a4j:form id="form" onsubmit="return validateForm(this);"> ... <a4j:commandLink action="#{bean.onClickSave}" onclick="linkType=L_SAVE;" reRender="form" eventsQueue="requestQueue"> <h:graphicImage title="#{Labels.SAVE}" url="#{Images['Save.png']}" /> </a4j:commandLink> ... </a4j:form>
in our js filefunction validateForm(f) { // ... some code to retrieve the message... if (!confirm(message)){ //Hacking RichFaces : queues should be cleared if onsubmit return false var eventsQueue = A4J.AJAX._eventsQueues['requestQueue']; if( eventsQueue ) { A4J.AJAX._eventsQueues['requestQueue']=false; if(eventsQueue.wait){ LOG.debug("Queue not empty, execute next request in queue "+options.eventsQueue); A4J.AJAX.SubmiteventsQueue(eventsQueue); } } //end hacking return false; } }
Notice that we always use the same queue 'requestQueue'.
It seems correct to you ? -
5. Re: eventqueue and confirm box in onsubmit()
nbelaevski Nov 8, 2008 7:16 PM (in response to ronanker)It seems to me there's no need to send request from queue if confirm call returns false even if eventsQueue.wait is true. Why not just clear the queue?
-
6. Re: eventqueue and confirm box in onsubmit()
ronanker Nov 10, 2008 5:06 AM (in response to ronanker)I don't know !
We just did the same as in the A4J.AJAX.finishRequest() method.
If you think that... if( eventsQueue ) { A4J.AJAX._eventsQueues['requestQueue']=false; } ...
is enough. It's fine for us.
In fact, I tought if there is some request pending in queue, we should send it viaA4J.AJAX.SubmiteventsQueue(eventsQueue);
-
7. Re: eventqueue and confirm box in onsubmit()
nbelaevski Nov 10, 2008 9:29 PM (in response to ronanker)"RonanKER" wrote:
If you think that... if( eventsQueue ) { A4J.AJAX._eventsQueues['requestQueue']=false; } ...
is enough. It's fine for us.