+ Start a Discussion
Ram Shiva KumarRam Shiva Kumar 

Problem with Action function

Hi , 

I have small issue with the action function,i wrote acode in sucha way that i wnat to use the action function in my VF code . But wen i  run the VF code iam not seeing the data{'hiiiiiiiiiiiiiiiiiii) which i mentiond in the M1 method  in the debug logs\. So  i think my method m1 is not beoing called form the Java script and even aim not getting the alert also which i defined in the page. My code is ,


<apex:page controller="bang1">

<script type="text/javascript">
  
  function f1()
  {
  
  alert ('Start invoking vf action!');
  
  
  
  }
 
</script>
  
  <apex:form >
  
  
  <apex:actionFunction name="f1"   action="{!m1}"  />
  <apex:commandButton value="enter"  onclick="f1"     />
  </apex:form>
  
</apex:page>


Controller:

Public class bang1
{

Public void m1()
{

System.debug('hiiiiiiii');



}

}

Pleasesuggest me.

Regards,
Siva

 
Swaraj Behera 7Swaraj Behera 7
Hi Ram,Please use below VF page and apex class.
 
<apex:page controller="bang1">

<script type="text/javascript">
  
  function f1()
	  {		    
	     f1();	  
			  }
			 
</script>
  
		  <apex:form >		  
					  <apex:actionFunction name="f1"   action="{!m1}"  />
					  <apex:commandButton value="enter"  onclick="f1();"/>
		  </apex:form>
  
</apex:page>

Apex Class:
Public class bang1
{

Public void m1()
{

  System.debug('hiiiiiiii');



}

}

Thanks
Ram Shiva KumarRam Shiva Kumar
Hi Swaraj,

Thanks for the code.

but still iam not getting the HI in debug logs.

Regards,
ram

 
Swaraj Behera 7Swaraj Behera 7
Hi Ram,
Can you show me the debug log of it.

Thanks,
Swaraj