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
TarentTarent 

Can i pass a javascipt variable into apex variable.

Like i get the id corresponding to a checkbox in javascipt .how do i reflect it into apex varible?

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

You can use <apex:actionFunction> tag  in visualforce page which can be called from javascript and pass that javascript variable in that function and then in controller you can get that javascript variable and assign it to Apex variable.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

You can use <apex:actionFunction> tag  in visualforce page which can be called from javascript and pass that javascript variable in that function and then in controller you can get that javascript variable and assign it to Apex variable.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
apex_keenapex_keen

It can be done using action function. A similar post exist( with same words) which answers your query..

 

http://boards.developerforce.com/t5/Apex-Code-Development/javascript-variable-to-apex-variable/m-p/461191

 

Revert if you've any doubts