I need to pass input field value from visual force page to the controller. This input value is not belongs to any object. It just a normal input value.

  • What have you tried so far? If you include your code then people will be more inclined to help.
    – BarCotter
    Commented Dec 8, 2014 at 12:14

3 Answers 3


The bindings doesn't require an object to work, just getters and setters. Let's suppose you want to ask for the user name, and store it in a variable.

The controller has to have the variable to store the name:

public String userName {get;set;}

And the visualforce page just need to have an apex:inputfield pointing to that variable:

<apex:inputfield value="{!userName}" />

If you want to pre populate that variable so the input displays something when the page loads just set the value on the constructor.


I am struggling with the same issue today and still haven't found a general solution to that which I can simply set the value in javascript. However, this blog post: http://bobbuzzard.blogspot.com.au/2011/07/passing-parameters-to-apex-method-from.html will probably help.


Create a controller extension class and in the extension class create a property for your variable.

Essentially use a wrapper class. You can then access the value in VF using


and in your extension class, you can access it as var.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .