You need to sign in to do that
Don't have an account?
Sebastian Page
Problem in action function with parameters
Hello All,
I am facing issue on action function with parameter. When i calling apex method from javascript then apex method called and create record in salesforce. I want update 3 salesforce fields from javascript variable vlaue value into salesfoce.
My code is here
public class BBH_SurveyCopy {
Public String Survey_comments {get;set;}
public String enteredText1{get;set;}
public String enteredText2{get;set;}
public String enteredText3{get;set;}
Public void createSurvey(){
BBH_Surveys__c bbh=new BBH_Surveys__c();
bbh.Ques1__c=enteredText1;
bbh.Ques2__c=enteredText2;
bbh.Ques3__c=enteredText3;
bbh.Surveys_Name__c='a2yW00000018lN0';
bbh.Survey_Comments__c =Survey_comments;
insert bbh;
}
}
vf page is
<apex:form id="fm" styleClass="Frm-c" >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:inputtextarea styleclass="fgh" value="{!Survey_comments}" cols="80" rows="3" Rendered="{!hidecmtbtn}"/><br/>
<apex:actionFunction name="echo" action="{!createSurvey}">
<apex:param name="firstParam" assignTo="{!enteredText1}" value="" />
<apex:param name="secondParam" assignTo="{!enteredText2}" value=""/>
<apex:param name="thirdParam" assignTo="{!enteredText3}" value="" />
</apex:actionFunction>
<div style="text-align:center; margin-top:40px;">
<apex:commandButton styleClass="asd" value="Update Survey" Rendered="{!modibtn}" onclick="modiresponse(event);" reRender="fm"/>
<apex:commandButton styleClass="asd" onclick="callActionMethod(event);" reRender="showmsg" Rendered="{!hidecmtbtn}" value="Submit Survey"/>
</div>
</apex:form>
function callActionMethod(event)
{
var txtVal1 ='1';
var txtVal2 = '2';
var txtVal3 = '3';
/*Below Method is generated by "apex:actionFunction" which will call Apex Method "echoVal"*/
echo(txtVal1,txtVal2,txtVal3);
}
Please help me on this
I am facing issue on action function with parameter. When i calling apex method from javascript then apex method called and create record in salesforce. I want update 3 salesforce fields from javascript variable vlaue value into salesfoce.
My code is here
public class BBH_SurveyCopy {
Public String Survey_comments {get;set;}
public String enteredText1{get;set;}
public String enteredText2{get;set;}
public String enteredText3{get;set;}
Public void createSurvey(){
BBH_Surveys__c bbh=new BBH_Surveys__c();
bbh.Ques1__c=enteredText1;
bbh.Ques2__c=enteredText2;
bbh.Ques3__c=enteredText3;
bbh.Surveys_Name__c='a2yW00000018lN0';
bbh.Survey_Comments__c =Survey_comments;
insert bbh;
}
}
vf page is
<apex:form id="fm" styleClass="Frm-c" >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:inputtextarea styleclass="fgh" value="{!Survey_comments}" cols="80" rows="3" Rendered="{!hidecmtbtn}"/><br/>
<apex:actionFunction name="echo" action="{!createSurvey}">
<apex:param name="firstParam" assignTo="{!enteredText1}" value="" />
<apex:param name="secondParam" assignTo="{!enteredText2}" value=""/>
<apex:param name="thirdParam" assignTo="{!enteredText3}" value="" />
</apex:actionFunction>
<div style="text-align:center; margin-top:40px;">
<apex:commandButton styleClass="asd" value="Update Survey" Rendered="{!modibtn}" onclick="modiresponse(event);" reRender="fm"/>
<apex:commandButton styleClass="asd" onclick="callActionMethod(event);" reRender="showmsg" Rendered="{!hidecmtbtn}" value="Submit Survey"/>
</div>
</apex:form>
function callActionMethod(event)
{
var txtVal1 ='1';
var txtVal2 = '2';
var txtVal3 = '3';
/*Below Method is generated by "apex:actionFunction" which will call Apex Method "echoVal"*/
echo(txtVal1,txtVal2,txtVal3);
}
Please help me on this
I hope you are doing well .....!!
Please add reRender="abc" in <apex:actionFunction name="echo" action="{!createSurvey}"> .
It works.
Let me know if don't.
Hope this helps you.
If this helps kindly mark it as solved so that it may help others in the future.
Thanks & Regards,
Foram Rana