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
SFDC0539SFDC0539 

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

Hi, 

 

 

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.

 

 

 

 

 

 

Thanks.....

 

 

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.

 

SFDC0539SFDC0539

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

SRKSRK

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

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

SFDC0539SFDC0539

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

SRKSRK

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

SFDC0539SFDC0539

Tried that as well...

 

 

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

==================================

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

===================================

 

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