function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dhaval PanchalDhaval Panchal 

Action function is not working.

Hi,

 

Below is my vf page. I have used action function control and java script to call controller method. When I have created this page, it was working perfactly. But today it is not working, I am not able to find any reason for that. If I use action in commandbutton directly then it works fine (that means my controller works fine). But as per my requirement I have to call that action using action function as this is a popup page.

 

<apex:page id="pg" controller="GeneralSettingsController" sidebar="false" showHeader="false">
    <apex:pageMessages id="msg"/>
    <apex:form id="frm">
        <apex:PageBlock id="pb">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save Settings" onclick="SaveSettings();"/>
                <apex:commandButton value="Cancel" onclick="window.close();"/>
            </apex:pageBlockButtons>
            Save Status: <B>{!saveStatus}</B><BR/><BR/>
            Remove chat history prior to &nbsp;&nbsp;<apex:inputField style="width:30px" value="{!objSetting.Time_Digit__c}"/>&nbsp;&nbsp;
            <apex:selectList style="width:75px" size="1" multiselect="false" value="{!objSetting.Time_Unit__c}">
                <apex:selectOption itemValue="Minutes" itemLabel="Minutes"/>
                <apex:selectOption itemValue="Hours" itemLabel="Hours"/>
                <apex:selectOption itemValue="Days" itemLabel="Days"/>
            </apex:selectList>
            
        </apex:PageBlock>
        <apex:actionFunction oncomplete="window.close();" id="afSaveSettingValues" name="SaveSettingValues" action="{!SaveSettings}"/>
    </apex:form>
    
    <script>
        function SaveSettings(){
            pg:frm:SaveSettingValues();
        }
    </script>
</apex:page>

 Please give me some suggestion to find out cause.

Daniel Zeidler (DZ)Daniel Zeidler (DZ)

Why do you need to use the action function component? What is stopping you from doing something like:

 

<apex:commandButton value="Save Settings" action="{!SaveSettings}" oncomplete="window.close();" reRender="pb"/>

 

Dhaval PanchalDhaval Panchal
This is a popup page, Once record is saved, page should be closed, we cannot do this using controller. But I need to call controller function. So I need to use action function.
Dhaval PanchalDhaval Panchal
I have resolved this issue using javascript, I have saved custom setting record using javascript.