You need to sign in to do that
Don't have an account?
Faisal Bahadur
How can I handle the datepicker event has selected date is change on an ui:inputDate field in Lightning
<ui:inputDate aura:id="dateValue" label="d" change="c.dateHandler" displayDatePicker="true"/> , I noticed the change event is not fired if you select the date via the date picker. ? any other suggestion
You can handle the "change" event on an attribute. In your component or app, add something like this:
<aura:attribute name="date" type="Date" access="GLOBAL"/>
<aura:handler name="change" value="{!v.date}" action="{!c.dateChange}"/>
<ui:inputDate aura:id="dateValue" value="{!v.date}" label="d" displayDatePicker="true"/>
In the controller add the dateChange function:
dateChange: function(component, event, helper) {
console.warn("dateChange");
var date = component.get("v.date");
console.warn("date is: ", date);
}
Let me know if this isn't what you are trying to do.
All Answers
You can handle the "change" event on an attribute. In your component or app, add something like this:
<aura:attribute name="date" type="Date" access="GLOBAL"/>
<aura:handler name="change" value="{!v.date}" action="{!c.dateChange}"/>
<ui:inputDate aura:id="dateValue" value="{!v.date}" label="d" displayDatePicker="true"/>
In the controller add the dateChange function:
dateChange: function(component, event, helper) {
console.warn("dateChange");
var date = component.get("v.date");
console.warn("date is: ", date);
}
Let me know if this isn't what you are trying to do.
Hi @SkikpSauls ,
thanks it works for me with little bit changes i just add change event on input field as well.
<ui:inputDate aura:id="dateValue" class="hideinput" label="d" change="{!c.dateChange}" value="{!v.date}" displayDatePicker="true"/>