You need to sign in to do that
Don't have an account?

apex:inputText - Fetch the text entered
I have defined a component that gets the values of indvidual text elements when <apex:commandButton> is pressed, but when I try to call some function using AJAX and use this object, it never gets filled (Still ooking for reasons..).
Only way left for me is to get these values individually create a new object with these values and use it in the function called for AJAX using apex:actionFunction + apex:param.
can anyone tell me how to get data from inputText and pass it, or best if someone can help me out how to pass an object with these values.
I am still quite new to topic but am learning every day.
- Samarthya
If you are using an ActionFunction component, the inputfield value should be submitted back to the controller prior to the associated action method being invoked.
If you post your code you might get some further insight.
I am not using action function component. (if i understood correctly)
This is what the action function does simply call a controller function.
The above is the call where I make a java script call that calls the actionFunction.
And I have a simple class address with few properties.
The corresponing controller for the TestPage is
When the outputPanel is cliked the address is set as null and that is my problem which I expect to put in value inserted in text boxes.
and this is the component I have defined.
You can bind the inputText value to getter-setter property in controller, and after clicking the button it can be accessable in controller :
// Defined the property in controller
Public string name{get; set;}
// bind the inputText value in page to this property
<apex:inputText value=”{!name}” id=”xyz”/>
If you want to access this value within page and want to use in AJAX call, then you can get this value like this using java script :
Var name=document.getElementById(“{!$Component.xyz}”).value;
Thank you for the reply, I did find this in other solutions when I googled. But my problem is When I have a Apex class dedicated for the values I have defined using individual string values would be redundant and improper. That is why I was looking for some other candidate solution.
Also, please correct me if I am wrong. When I define a component and use it in a Apex Page the object is implictily initialized, that is; If I have a single object of a class defined (as in code above - Address) the setter is called with the value, but what if I define a object of similar type in the code say Address add2?
- Samarthya
Any help pointers anyone?