I have gone through Many Links Sample- Link but couldn't get the answer. I Have a Sobject to be filled beforei hit the apex controller.
Structure in component is:
<aura:attribute name="newFeedbackObj" type="sObject" default="{
'sobjectType': 'Feedback__c','Chose_Category__c':'' }"/>
<aura:attribute name="categoryList" type="String[]"/>
And in doInit method i am fetching all picklist from the object using schema.
<ui:inputSelect label="Categories" class="slds-input" aura:id="feedback_Category"
labelClass="slds-form-element__label" change="{!c.onChangePickVal}">
<aura:iteration items="{!v.categoryList}" var="s">
<ui:inputSelectOption text="{!s}" />
</aura:iteration>
</ui:inputSelect>
When compenent loads, all the picklists values comes correctly. Upon changing the value, i am calling a jsController as below.
onChangePickVal : function(cmp){
var selectCmp = cmp.find("feedback_Category");
console.log('selectCmp >>'+selectCmp);
component.set("v.newFeedbackObj.Chose_Category__c", selectCmp.get("v.value"));
console.log('Selected Value>>'+selectCmp.get("v.value"));
}
But at the end, the chosen pick list value is not being sent. can someone plesae help me. I want to pass the selected value to sObject.
I even get the correct chosen value in by console.log "Selected Value>>". I just don't know how can i pass it to sObject.
Best Answer
@ItaiShmida Thanks for yur input but somehow it didnt worked. So as a last option i passed the Selected category as One of the Parameter to my Apex controller and then just before created it I changed the value of the object.
And in my apex Controller :