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
BubuBubu 

Action function is not working in Mozilla Fire Fox brower

Hi All,
Action function is not working in Mozila fire fox ,however it is working in Chrome .Why I have added funTwo here as I need to implement confirm dialog on this .
 
<apex:page controller="TesActFunction">
	<apex:form id="frm" >
		<apex:commandButton value=" Test" onclick="funOne();"/>
		<apex:actionFunction action="{!actionMethod}" name="funTwo" reRender="frm" />
	</apex:form>
	<script>
		function funOne(){
			funTwo();
		}
	</script>
</apex:page>
public class TesActFunction {
	public PageReference actionMethod() {
        System.debug('mmmmmmmmmmmmmmmmmmmmmmmm');
        return null;
    }
}

Please let me know if any one has any work around .
 
Best Answer chosen by Bubu
Prem Anandh 1Prem Anandh 1
Hi Bubu, 

Hope below code works for you. Please let know.
 
<apex:page controller="TesActFunction">
	<apex:form id="frm" >
		<apex:commandButton action="{!actionMethod}" value="Test" reRender="frm" onClick="if (testScript() === false) { return false; }" />
	</apex:form>
	
	<script>
	    function testScript()
	    {
	       if(confirm('OK/Cancel')) 
	       {
	           alert('True');
	           return true;
	       }
	       else
	       {
	           alert('False');
	           return false;
	       }
	    }
	</script>
</apex:page>

Thanks,
Prem Anandh

All Answers

Pankaj_GanwaniPankaj_Ganwani
Hi,

I have updated your code a bit. Can you try with this:
 
<apex:page controller="TesActFunction">
	<apex:form id="frm" >
		<apex:commandButton value=" Test" onclick="return funOne();"/>
		<apex:actionFunction action="{!actionMethod}" name="funTwo" reRender="frm" />
	</apex:form>
	<script>
		function funOne(){
			funTwo();
                        return false;
		}
	</script>
</apex:page>
public class TesActFunction {
	public PageReference actionMethod() {
        System.debug('mmmmmmmmmmmmmmmmmmmmmmmm');
        return null;
    }
}



 
Prem Anandh 1Prem Anandh 1
Hi Bubu, 

Why you can's use apex:CommandButton action attribute to invoke the methods? Please see below code. 
 
<apex:page controller="TesActFunction">
	<apex:form id="frm" >
		<apex:commandButton action="{!actionMethod}" value="Test" reRender="frm" />
	</apex:form>
</apex:page>

Please let me know if you need anyhelp. 

Thanks,
Prem anandh
BubuBubu
Hi Pankaj,

That also I have tried before was not working ,any other work around  please ?
 Prem Anand ,
Thanks for your smart reply,I need to implement confirm dialog in this code that is the reason I am calling from action function .

 
Prem Anandh 1Prem Anandh 1
Hi Bubu, 

Hope below code works for you. Please let know.
 
<apex:page controller="TesActFunction">
	<apex:form id="frm" >
		<apex:commandButton action="{!actionMethod}" value="Test" reRender="frm" onClick="if (testScript() === false) { return false; }" />
	</apex:form>
	
	<script>
	    function testScript()
	    {
	       if(confirm('OK/Cancel')) 
	       {
	           alert('True');
	           return true;
	       }
	       else
	       {
	           alert('False');
	           return false;
	       }
	    }
	</script>
</apex:page>

Thanks,
Prem Anandh
This was selected as the best answer
BubuBubu
Thanks Anand ,It is working .