You need to sign in to do that
Don't have an account?
Pradeep Bandarpalli
Values are not getting passed from component to client controller when attribute type is sObject "Event"
HI,
I have a requirement to create a new Event from a custom lightning component. the code i used is below
<aura:component >
<aura:attribute name="newEvent" type="Event"
default="{ 'sobjectType': 'Event',
'Subject':'',
'Description':''
}"/>
<div>
<ui:inputText aura:id="subject" class="slds-input" value="{!v.newEvent.Subject}"
placeholder="Enter Subject"/>
<ui:inputTextArea aura:id="comment" class="slds-input" value="{!v.newEvent.Description}"
placeholder="provide your comments"/>
<button class="slds-button slds-button--neutral" onclick="{!c.cancel}">Cancel</button>
<button class="slds-button slds-button--neutral slds-button--brand" onclick="{!c.save}">Save</button>
</div>
</aura:component>
---controller----
({
save : function(component) {
var event = component.get("v.newEvent");
window.alert(event); //getting undefined
}
})
I am getting values as undefined. In case if I use sObject as Task instead of an Event, this is working Good and values passed are getting displayed. Is this due to the confusion between lightning events and sObject Event or anything ? Any help here is very much appreciated.
Thank You!
I have a requirement to create a new Event from a custom lightning component. the code i used is below
<aura:component >
<aura:attribute name="newEvent" type="Event"
default="{ 'sobjectType': 'Event',
'Subject':'',
'Description':''
}"/>
<div>
<ui:inputText aura:id="subject" class="slds-input" value="{!v.newEvent.Subject}"
placeholder="Enter Subject"/>
<ui:inputTextArea aura:id="comment" class="slds-input" value="{!v.newEvent.Description}"
placeholder="provide your comments"/>
<button class="slds-button slds-button--neutral" onclick="{!c.cancel}">Cancel</button>
<button class="slds-button slds-button--neutral slds-button--brand" onclick="{!c.save}">Save</button>
</div>
</aura:component>
---controller----
({
save : function(component) {
var event = component.get("v.newEvent");
window.alert(event); //getting undefined
}
})
I am getting values as undefined. In case if I use sObject as Task instead of an Event, this is working Good and values passed are getting displayed. Is this due to the confusion between lightning events and sObject Event or anything ? Any help here is very much appreciated.
Thank You!
Use type="Object". Some objects are not directly supported I think.