+ Start a Discussion

How to store/bind data into SF database by inputText (not inputField)?

I am developing a VF page where all lookup fields (for both parent & child object) will be replaced by autocomplete/typeahead. It is suggesting perfectly for lookup fields, User-added image
but can't store the selected value into the database, therefore, the field value for that loop is empty after creating the record.
I have used SELECT2 3.4.2 version to build the autocomplete component, & the reason why field value is not posting is i have used inputText in component controller.
<apex:inputText style="{!Style}" styleClass="auto{!randomJsIden}" value="{!cacheField}" />
    <apex:outputPanel id="hiddenPanel">
    	<apex:inputText value="{!targetField}" id="hiddenField"     styleClass="hiddenField{!randomJsIden}" style="display:none"/>
    <script>v2{!randomJsIden} = new typeahead{!randomJsIden}({});</script>
I find that a good way to store inputText into database is mentioned here. But, it only works for Sobject (I have sobject where it is not working, I have list where this technique is throwing error).
The component code in the VF page is
<c:TypeAheadComponent allowClear="true" importJquery="true" labelField="Name" SObject="General_Ledge_Account__c" valueField="Id" targetField="{!targetField}"  style="width:15rem" />
In summary, I am trying to perform autocomplete for lookup fields in VF page (parent record & multiple children record are creating from this VF page). Autocomplete is fine (collecting data from database), but whatever I am selecting from VF page is not Stored in the database. Any idea how can I use inputText to store/bind user selected data into the backend database?

NagendraNagendra (Salesforce Developers) 
Hi TanD,

Please check with below link from stack exchange community with similar kind of issue and possible work around. Please mark this as solved if it's resolved so that it gets removed from the unanswered queue.