+ Start a Discussion
mba75mba75 

JQuery 1.3.2 Apex CommandButton does not redirect correctly after jquery upgrade

Hi

 

I have a jquery dialog containing a  Dropdownlist and a OK commandbutton (Apex:commandbutton) in a component.

That version do nothing

 

<apex:commandbutton id="update_spr" value="Select" action="{!updateSPRId}" />

 

 

I also tried with rerender

"Quotedetail" is the id of an APEX:detail tag 

 

But the Following version

<apex:commandbutton id="update_spr" value="Select" action="{!updateSPRId}" rerender="Quotedetail"/>

 

this one redirect to an AJAX error page

 

 

this button call the following action

 

public pagereference updateSPRId(){ SPR_utils.utils sp=new SPR_utils.utils(); if (quoteid!=null){ Quote__c q=[select id,Special_Pricing_Request__c from Quote__c where id=:quoteid]; if (SP_Request=='New'){ q.Special_Pricing_Request__c=sp.Newid(opp.AccountId);} else {q.Special_Pricing_Request__c=SP_Request;} update q;} pageref=apexpages.currentpage(); pageref.setredirect(true); return pageref; }

 

If I use a command link it works .

 

that commandButton use to works with jquery 1.2.6  

 

Any idea ?

 

 

 

 

 

 

Ron HessRon Hess

jquery dialog does some serious things to your DOM, it rips the html out of the form and appends it to the end of the body, therefore it is not inside the apex : form tags at all

 

you can see this by using firefox when the dialog is up on the page.

 

two things that do work

 

use simplemodal dialog, and specify that the html shoudl be appended to apex form instead of body

 

use simplemodal and specify an iframe to a new page to appear in the modal, that page has it's own form.

 

 

 

ConejoConejo

I'm having the same problem trying to get an ajax call to trigger when a button is clicked on a jQuery modal.

 

I was able to get the behavior to change a little bit by adding this to my document.ready function:

 

 

j(document).ready(function() {
    	j('#select-account').dialog({autoOpen: false, closeOnEscape: true, modal: true});
    	
    	var dialog = j('#select-account').parent(); 
    	var form = j(omsFormDomId); 
    	form.append(dialog);
    	
    	
    });

 

It creates my modal dialog, then I go fetch it and append it to my form. The ajax doesn't fire, but the page does submit.

 

It's still not working, and I could use guidance what to try next.

 

Thanks,

 

Rich C.