Primefaces Ajax response fail randomly - ajax

I am using p:datatable and on clicking of row (Command link) I am displaying a panel. Most of the time it is working fine but in regression testing some time it is getting hanged but request is going to ManageBean fetching all the data.
But it is not rendering the panel. This error has no specific pattern. I have put log in all possible place even in phaselistner lifecycle everything looks good.
I checked in firebug response is also coming. from server
I am using weblogic 10.3.6,primefaces 3.5 and internet explorer 9.x

Try putting in a component in the page where the data table lives. This displays Ajax events and alot more. Then compare the log output for when it succeeds against the output for when it fails. This may point to DOM as was suggested or somewhere else.

Related

reCaptcha google chrome Spring MVC double submit issue

I am using Spring MVC 3, and JSP/JSTL for the view. I have incorporated reCaptcha in my form. I am noticing some very strange behaviour that is not consistent (i.e. it doesn't happen all the time, it's random) when I submit my form. This ONLY happens with Google Chrome.
I have searched the web but was not able to find any information about this problem.
Basically, when I submit my form including a valid captcha, I am bounced back to the form page YET the captcha was VALID. I got lucky and was able to debug it once and saw the captcha was valid, but the flow of control is somehow being intercepted DESPITE it executing the return ModelAndView logic.
So in other words, it should return a ModelAndView controller with the new view in it, but instead the flow of control goes back to the top of the function!!! and it hits the recaptcha code BUT by this time the recaptcha code is invalid, so it says FALSE. THEN it goes back to the original form page. What is frustrating about this is there is a commit to my production database that happens because the captcha was originally valid and other valid logic that is executed as per normal behaiour.
The reCaptcha box is the only box marked with an error and it states that you must re-enter the code. The only major issue is even if my reCaptcha was bad, it should come back immediately and say try again, which it does, but it SHOULD not appear as valid, highjack the flow of control and then redirect back to the form page.
The end result is I get 2 exact records in the database because the user submits again. It only happens in this way. i.e. I haven't come across a scenario when you have to submit 3 times or more.
This is ONLY happening in google Chrome. I have tried this on firefox and IE but I have never seen this issue. Someone in another country just submitted information via this form and I asked them what browser they were using, and they confirmed it was chrome! I too have had enough encounters with this issue to know it actually is an issue.
Does anyone know why the flow of control goes back to the top of the function?? One other thing I noticed is the flow of control doesn't always go to the bottom, it's like it's got a mind of its own. One other time I was stepping through and it just jumped to the top.
ANY HELP would be kindly appreciated as I am trying to figure this out in a production system!!
Thanks!!

JQuery Mobile 1.0 - Self-posting pages causing duplicate dialogs or history entries

If you go to http://jsbin.com/ibozun/2, hit "Add Item," and then hit "Save," you will see that a second dialog is opened on top of the first one. The form in the dialog is posting to itself (no action defined) - this is by design. Because the dialog has duplicated itself, now you have to hit "Cancel" 2 times to get it to close.
The use-case for this setup is a MS MVC3 page with unobtrusive JQuery validation on it. The default scripts (in other words, I have no custom validators - the scripts are straight from MS) cause an ajax call to the server, and JQM treats that the same as a self-posting form - so you wind up with a duplicate dialog if validation fails.
A similar thing happens if the second page as a page, rather than a dialog - the form posting to itself results in a second history entry in the browser, so to get back to page 1, you have to hit back 2 times.
I believed this be a bug in JQM, but after submitting a bug on GitHub, I was told that this is the expected behavior. So, assuming this behavior that will not be changing in the framework, how do I prevent this from happening for my instance (preferring NOT to edit the framework JS)? Do I have to write my own ajax calls for validation so that I can prevent JQM from knowing that anything has happened? That seems unfortunate...
One idea I had was to detect that the nextPage and current page are the same on "pageHide", and manipulate the dialog/history myself, but have had no luck.
Thanks in advance!
First, there is no dialog duplication in the example. Second, my response and an explanation as to why solving the history issues with posting back to the same page for users of the library is hard can be found here. This example is particularly thorny because it's also in a dialog which we don't support linking to, so disabling ajax for the form (ie forcing it to reload), which would work if it were embedded in a page, won't serve.
The quick solution here is to switch the dialog to a page and add the data-ajax=false data attribute to the form. Mind you this causes a page flash/reload and requires that the form document be fully formed with a head including javascript,css, etc.

EditLive! Rich Text Editor - submitting form via ajax

The project I'm working on is using the Java EditLive! rich text editor. I've been trying to make the EditLive form post via ajax, but am having some problems using IE8. Here are the steps we're taking:
Load the main page
The user clicks a link and the EditLive applet is loaded and attached to the page via ajax
The user finishing editing their document and clicks the submit button
The form posts via ajax (we're using jQuery.post())
The EditLive section is reloaded and the EditLive content is correct.
The form immediately posts again
The EditLive content is back to being blank.
Unfortunately (for debugging reasons), this is not happening in FireFox - there is only a single form post and the values are saved correctly.
From what I can tell debugging this in IE8, it looks like the submit event is getting called twice with 2 different forms. My thought is that the applet isn't getting destroyed correctly, though I've tried everything in my power to destroy it.
So I was wondering if anyone has any experience successfully submitting EditLive data via ajax? Or maybe this is just a limitation to the product?
Any help would be greatly appreciated!
I know this is an old issue but you likely want to look at the autoSubmit property of EL:
http://docs.ephox.com/display/EditLive7/AutoSubmit+Property
http://docs.ephox.com/display/EditLive/AutoSubmit+Property
I suspect that by using an AJAXy submit process this is somehow causing you issues with EditLive and its standard behavior. I would try turning off autoSubmit and grabbing the content yourself in your jQuery posting process.

jQuery.post form submit odd bug firefox only

I've search high and low for an answer to this but unfortunately I'm stuck. The problem is only occuring in Firefox (tested IE, Chrome and Safari also - works fine, no errors of any sort). I'll detail the sequence of events to save posting all my code.
ASP.NET MVC 3 application, basic form loads into a jQuery UI dialog
Custom jQuery to hijax the form submit (serialize the form and then $.post to the server - no compiler errors when debugging and post shows up in Firebug without errors)
Http GET (automatically happens) getting the response object from the server (+ success text and XHR), response is plain HTML in this case (again, shows up in Firebug with no errors)
Custom jQuery to change the HTML of the UI dialog from it's current HTML to the response Html - this is where it fails.
I've used javascript alerts to debug the sequence of events and as soon as the post (and get) is complete, everything just... sort of stops.
As I say, only in firefox! Very odd, just wondering if there's any known bugs with ajax and firefox or anybody has heard of a similar situation?
I must also add, that on other parts of my site, this works perfectly in all browsers! The only difference between this form and the other forms that do successfully complete the function is that the response from this form is the same "page" again but updated rather than a new "page". (I use "page" as I got all this working with Javascript turned off first and for graceful degredation)
HELP! Or laugh, either is fine.
UPDATE
I have tried sending a view with a blank model back as the action result - works in every browser except firefox - firefox retains the values from the previous post! And then I got to thinking - that's a trait of firefox isn't it? And maybe that's why the original "re-direct" html response doesn't work?? I think it's time to give up and let people know they can't use Firefox for that particular function!
Ok so I'm answering my own question.
The only way I found to get round it is to use $.ajax instead of $.post and to use the option async : false
Hope this helps somebody.
Rob
Have you tried adding the attribute [OutputCache(Location = System.Web.UI.OutputCacheLocation.None)] to your Action for your GET? It sounds to me like a caching issue.

Executing AJAX scripts within an AJAX response

I'm having trouble using AJAX page updates along with other AJAX scripts.
During a normal page load, the AJAX scripts (picture scrolling and picture thumbnails) work fine. But when I update a page with AJAX, these scripts (usually loaded in the header of the initial page load) stop working.
I am wondering if this is specific to these scripts and I need to look into them deeper to resolve/re-write or if I am missing something more generic in combining AJAX page updates with AJAX scripts the returned code relies on.
Embedded javascript runs fine.
Thanks for your ideas!
PS: The scripts I am using are from www.dynamicdrive.com are:
1) stepcarousel (http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm) and
23) thumbnailviewer (http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm) from the
Try doing this on Firefox, using the Firebug debugger, so you can single-step through and determine what is going on with the javascript. If you are using IE8 then you can hit F12 and bring up the debugger for that environment also.
Once you have some idea what is going on then you can explain what you are seeing, what browsers you have tried and you will get more help.

Resources