You need to sign in to do that
Don't have an account?
apex command button action command not working
I have an command button whose action method calls a method in my controller, the method is invoked and returns back to the commandbutton in which I have a 'onComplete=window.close();' which closes the window but the method invoked in my controller does absolutely nothing.
I tried putting in broken code in that method and also tried everything I could to recieve an error message or atleast SOMETHING back from that method but I get nothing.
Any help would be greatly appreciated.
Thank's
<apex:page standardController="Speaker_Bureau_Membership_gne__c" showheader="false" sidebar="false"
extensions="em3_bureau_nomination_ctrlr">
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:form >
<!-- <apex:commandButton action="{!nominate}" value="Nominate Speakers"/>
<apex:commandButton action="{!cancel}" value="Cancel" onClick="window.top.close();"/>
<apex:actionFunction name="Nominate" action="{!nominate}" id="out"
status="myStatus" onComplete="window.close();"/>
-->
<apex:commandButton id="nominate" value="Nominate Speakers" action="{!nominate}" onComplete="alert('complete'); window.close();" />
<apex:commandButton value="Cancel" onClick="window.close();"/>
</apex:form>
</apex:pageBlockButtons>
<apex:Repeat value="{!members}" var="m">
<apex:pageBlock >
<apex:form >
<apex:facet name="header"><b>{!m.name}</b></apex:facet>
<apex:pageBlockSection title="{!m.name}" collapsible="false" columns="3">
<apex:outputField value="{!m.Bureau_Member_gne__c}" />
<apex:pageBlockSectionItem >
<apex:outputLabel value="Spaker Bureau" for="speaker_bureau"/>
<apex:selectList value="{!selected_option}" multiselect="false" size="1" id="speaker_bureau">
<apex:selectOptions value="{!Bureaus}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:inputField value="{!m.Speaker_Scope_gne__c}" />
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
</apex:Repeat>
</apex:pageBlock>
</apex:page>
apex controller method:
somes lines have been depricated that i just threw in while testing so there ignore them.
public void nominate(){ List<Speaker_Bureau_Membership_gne__c> nominations = new List<Speaker_Bureau_Membership_gne__c>(); for(Speaker_Bureau_Membership_gne__c membership : this.members){ nominations.add(new Speaker_bureau_membership_gne__c( User__c = Membership.User__c, Speaker_Status_gne__c = 'Nominated', Speaker_Scope_gne__c = membership.Speaker_Scope_gne__c, Speaker_Bureau_ID_gne__c = membership.Speaker_Bureau_ID_gne__c, Nomination_Date_gne__c = System.now(), Nominated_By_gne__c = UserInfo.getUserID(), Bureau_Member_gne__c = membership.Bureau_Member_gne__c )); } //try{ insert(nominations); //}catch(DmlException e){ //System.debug(e.getMessage()); //} //return (new ApexPages.StandardController(Speaker_Bureau_Membership_gne__c)).view(); }
I ran into a similar issue where command button action method was not getting invoked.
I first tried setting the commandButton immediate to true so that any validation for fields on the page and i noticed the method getting called. Then i included <apex:pageMessages /> on top of page to find out the exact error that was causing this behavior.
It turned out that there was a type conversion issue with one of the merge field that I had used.
Hope this helps those searching for clues.
Regards
All Answers
I ran into a similar issue where command button action method was not getting invoked.
I first tried setting the commandButton immediate to true so that any validation for fields on the page and i noticed the method getting called. Then i included <apex:pageMessages /> on top of page to find out the exact error that was causing this behavior.
It turned out that there was a type conversion issue with one of the merge field that I had used.
Hope this helps those searching for clues.
Regards
I tried the same. I have command button with onClick confirm JS message and onComplete calling action function. Its working for both onClick and onComplete JS actions, but its not calling Action method on controller. I tried calling actionFunction and actionfunction making call to Action method in controller, but same behaviour.
My action button need to prompt user for confirmation and upon confirmation I am deleting a record and I need to rerender the section to show the record deleted (its Apex data table).
Any help would be appreciated.
Thanks