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
madhumadhu 

how to pass value from vf page to controller ??

how to pass value from vf page to controller ??
nbknbk
refer link for reference - http://salesforce.stackexchange.com/questions/36580/passing-a-value-from-visualforce-page-to-controller
justin_sfdcjustin_sfdc

Hi Madhu, 
Just call the datatype in the visual force page. That should work.
Example:
//Apex Class
class vf_controller {
   public string variable {get; set;}
   ....
   ....
   variable = 'Apple';
}

VF page:
<apex:inputField value = {!variable} />

Hope that helped!

LakshmanLakshman
madhu,
You need to define a public variable with getters and setters and use standard visualforce page input tags for that variable so that it gets binded to your visualforce page. Something like below:
 
---------------Apex Class---------------
public bindController {
public String bindVar {get;set;}
public bindController () {
  bindVar = 'Some Default';
​}
public void change() {
  system.debug('Changed----' + bindVar );
}
}

---------------VF Page---------------
<apex:page controller="bindController">
  <apex:form>
    <apex:inputText value="{!bindVar}" />
    <apex:commandButton value="Change Value" action="{!change}"/>
  </apex:form>
</apex:page>
Let us know if this helps.

Thanks,
Lakshman
 
SalesforceLearnerNewbieSalesforceLearnerNewbie
How come all the answers here is the opposite. From what I understand the question is about from VF PAGE to CONTROLLER and all the answers only gave from CONTROLLER to VF PAGE.... it is easy to pass from CONTROLLER to VF PAGE but we beginner do not know how to PASS from VF PAGE back to CONTROLLER. Even when asked in the forum, we get the opposite answer. May I know whether is this even solving the question here already? 

I have the same question as this post but it never gets answered at all