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

How to pass the value from JQuery result to Page Controller.




I'm using the JQuery Autocomplete in a VF component. I need help with passing the selected value from the JQuery .result(function(event, data, formatted) funtion  to the page controller. Please let me know how can i do this.










Bhawani SharmaBhawani Sharma

I think, you can store your selected value on some hidden field on component and when you are clicking the Save button, using javascript set this value in a controller property.



I have tried doing that but that is not working....


try it with apex:input field not with apex:inputhidden

& if it work the hide the apex:inputtext using <div style="display:none"/>


It does not return a value if i use apex:inputText, but i do get a value if i use input type="text" and the value={!the_value_to_be _set}  but this is not being set in the controller


when u click submit button call a javascript & in javascript using document.getelemetbyId get this input tyoe ="test" field & put it's values into apex:inputtext or u can use apex:param


Tried that as well...



function setName(){
var txt = document.getElementbyid("hiddenId").value;
alert("Text : " + txt);
document.getElementById("clnm").value = txt;
alert("In SetName : " + document.getElementById("clnm").value);


<apex:commandButton onClick="setName()" action="{!srch}" value="Find">
<apex:param value="{!clientName}" id="clnm"/>



Function and the commandbutton code.....but this is not working......