Parameter passing using Javascript+actionFunction in visualforce

In visualforce, there is a method for passing parameters from visualforce page to controller using javascript and actionFunction. Here is the example;

/*JavaScript*/
<script type="text/javascript">
function doSave(date) {
paraFunction(document.getElementById(date).value);
}
</script>

/*Action Function*/
<apex:actionFunction name="paraFunction" action="{!saveInterviewDate}" rerender="view">     
<apex:param id="aname" name="interviewDate" value="" />
</apex:actionFunction>

/*Call the javaScript from here*/
<apex:commandLink onclick="doSave('{!$Component.interviewDate}');">               
<apex:commandButton value="Save"/>
</apex:commandLink>

/*get the parameter in controller*/
String interviewdate=Apexpages.currentPage().getParameters().get('interviewDate');

Comments

  1. Very helpful link.. Thank you for sharing it!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. • Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating mulesoft Online Training
    "

    ReplyDelete
  4. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingmulesoft online training

    ReplyDelete
  5. this one may be obvious but needs to be stated: most people don't learn by listening to an instructor or watching videos and e-learning; they learn by doing; each student should have his or her own workstation or device and should practice every process taught in class Salesforce training in Chennai

    ReplyDelete


  6. That is nice article from you, this is informative stuff. Hope more articles from you . I also want to share some information about Salesforce CPQ Training

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Trade FX At Home On Your PC: roboforex login Is A Forex Trading Company. The Company States That You Can Make On Average 80 – 300 Pips Per Trade. roboforex login States That It Is Simple And Easy To Get Started.

    ReplyDelete
  9. Nice Topics.. Read My Review Of An Online Cfd Trading Broker, usd-rmbWith A Focus On Their Platform And Customer Support Services. I Have Been Using Them For Over A Year And This Is My Honest, Unbiased Review.

    ReplyDelete
  10. fine site, wherein did u come taking area toward the rear of the caution in regards to this posting? I'm positive I found it despite the fact that, ineffectively be looking at by means of now soon to find what addendum posts you enhance. thanks! Paragon NTFS Crack

    ReplyDelete
  11. I needed to thank you for this in your loving capture!! I especially partaking in all minuscule piece of it I have you ever bookmarked to look at conveyed stuff you articulate. thanks! Fonepaw Iphone Data Recovery Registration Code

    ReplyDelete
  12. for certain i'm absolutely in all honesty later this article and that I on a very basic level pulse broadcast that this flyer is totally conceivable and truely educational article.i will make obvious for look at your weblog more. You made an unadulterated lightening in any event can't designate dissipate to regardless bewilderment, what by and large the fresh out of the plastic new part? !!!!!!thanks. Birthday Wishes For Sister In English

    ReplyDelete

Post a Comment

Popular posts from this blog

Displaying pop-up summaries on hover in visualforce

Do you want to be certified as a Salesforce Admin?

Unit Testing in Salesforce