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
crusader2016crusader2016 

JQuery Communication for Salesforce

Hi All,

 

I embeded a jquery codes in my custom vf page. What I would like to do is to use the jquery elements (ie, textbox,radio button, links, etc.) to communicate with Salesforce objects that is when a user clicks the save button, records will be created using the data that was filled in from the jquery elements. Please advise on what is the best way to do this kind of scenario. 

 

Thanks in Advance

Best Answer chosen by Admin (Salesforce Developers) 
arizonaarizona

The save button might be able to run javascript that copies the data from the jscript components to salesforce hidden components that are inside a salesforce form and would submit the form.

 

Something like

 

<submit name="Save" onclick="saveToSF();">

 

<script>

saveToSF = function() {

document.getElementById("{!$Component.SFDCForm1.field1}").value = document.getElementById("Your form fieldid").value;

...

document.getElementById({!$Component.form1.submit1}").click;

};

</script>

 

<apex:form id="form1">

<apex:inputHidden value="{!name}" id="field1" />

<apex:commandButton action="{!yourControllerMethod}" id="submit1" />

</apex:form>