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
lingannalinganna 

controller method calling from actionfunction

 

HI 

 

I am calling process() method from <actionfunction> tag there no compilation error

but the method unable to invoke.

 

anybody help me.

thanks in advance

 

 

public with sharing class PassParameterActionFunction {

public string name{set;get;}
public string nameval{set;get;}
public void process(){

nameval=name;
}

}

 

 

..............................................................

 

 

<apex:page controller="PassParameterActionFunction">
<apex:form id="theform">
<apex:outputPanel id="thepanel">
<apex:outputlabel value="{!nameval}"/>
</apex:outputPanel>

entername:<apex:inputtext id="thename"/>
<apex:commandButton onclick="show();" value="show"/>


<apex:actionFunction name="display" action="{!process}" rerender="thepanel">
<apex:param name="first" assignTo="{!name}" value=""/>
</apex:actionfunction>
</apex:form>
<script type="text/javascript">
function show(){

var a=document.getElementById("{!$Component.theform.thename}").value;
display(a)
}
</script>

</apex:page>

 

sunny@99-chgsunny@99-chg

linganna we r busy yar......

bob_buzzardbob_buzzard

If this is an exact cut and paste of the code, I'd imagine its because you are invoking a method called dispaly, but your javascript function is named display:

 

var a=document.getElementById("{!$Component.theform.thename}").value;
dispaly(a)

 This won't cause any compilation error, as the IDE can't validate javascript.  

 

lingannalinganna

I replaced with dispaly  with display but unable to get output.

SRKSRK

hmmmm i know this issues

just give id to actionfuction

try this
<apex:actionFunction name="display" action="{!process}" rerender="thepanel" id = "display">

SRKSRK

as bob_buzzard 

put u  "var a=document.getElementById("{!$Component.theform.thename}").value;"

under try catch

 

try

{

  var a=document.getElementById("{!$Component.theform.thename}").value;

}

catch(ex)

{

  alert(ex);

}

lingannalinganna

I have given id="display" but not unable to get output .and what is the use of id attribute in this situation.

lingannalinganna

I am getting the input text value in javascript variable but the function not invoking

SRKSRK

I understand u r point that ID parameter is of no use in this case but i have face same kind of issues

then i give ID to action function  ID to param both then it start working for me

SRKSRK

I belive to define the ID parameter in the the attribute

action function & param

sunny@99-chgsunny@99-chg

wt linga sir inka raleda....