How to get input field value in controller in salesforce

image

Assuming your lightning:inputField tag has the aura:id of firstNameField, for example, you’d get its value with: var firstName = component.find (“firstNameField”).get (“v.value”); In your second example, in your find call, you are using an uppercase A, whereas in your code the aura:id has a lowercase a:

Full
Answer

How to get input field value from page using custom controller?

The easiest approach to get the value from inputText using custom controller and save it, is by getting and setting the variable in custom controller. And no need of Component in this case. Refer to the following code to get input field value from page using Custom Controller. Please mark it as best answer if you find our answer helpful.

How do I get the value of a lightning input field?

Assuming your lightning:inputField tag has the aura:id of firstNameField, for example, you’d get its value with: In your second example, in your find call, you are using an uppercase A, whereas in your code the aura:id has a lowercase a:

How to get the exact path of an input field?

Try to inspect the input field and fetch the exact path, if required. The Id should be referenced using $Component, So in your case the Id would be reflect like this. Also try giving id value to pageblock and pageblocksection as well , so that exact path can be identified. Try to inspect the input field and fetch the exact path, if required.

image

Leave a Comment