You need to sign in to do that
Don't have an account?
anji punyamanthula
Lightning:input values are not getting refreshed when we are cancel it
Component-Markup:
<div class="slds-form-element__control">
<div class="uiInput uiInputDate uiInput--default uiInput--input uiInput--datetime">
<label class="label inputLabel uiLabel-left form-element__label uiLabel">
<span class="">{!v.customField.musqotmpm__startdate__c.Label}</span>
<span class="required ">*</span>
<aura:if isTrue="{!!empty(v.customField.musqotmpm__startdate__c.InlineHelpText)}">
<lightning:helptext content="{!v.customField.musqotmpm__startdate__c.InlineHelpText}" />
</aura:if>
</label>
<lightning:input aura:id="date-StartDate" type="date" name="" label="" class="ltng-label-hide" value="{!v.sObject.Musqotmpm__StartDate__c}" onchange="{!c.handlePeriod}" />
</div>
</div>
Component:Js:
closeModal : function(component, event, helper) {
component.set("v.hasErrors", false);
$A.get('e.force:refreshView').fire();
//$A.get("e.force:closeQuickAction").fire();
//helper.readCustomField(component, event, helper);
//document.location.reload(true);
helper.hideModal(component, event, helper);
//component.set('v.sObject', {});
if(!component.get('v.fromPlan')){
window.history.back();
}
},
<div class="slds-form-element__control">
<div class="uiInput uiInputDate uiInput--default uiInput--input uiInput--datetime">
<label class="label inputLabel uiLabel-left form-element__label uiLabel">
<span class="">{!v.customField.musqotmpm__startdate__c.Label}</span>
<span class="required ">*</span>
<aura:if isTrue="{!!empty(v.customField.musqotmpm__startdate__c.InlineHelpText)}">
<lightning:helptext content="{!v.customField.musqotmpm__startdate__c.InlineHelpText}" />
</aura:if>
</label>
<lightning:input aura:id="date-StartDate" type="date" name="" label="" class="ltng-label-hide" value="{!v.sObject.Musqotmpm__StartDate__c}" onchange="{!c.handlePeriod}" />
</div>
</div>
Component:Js:
closeModal : function(component, event, helper) {
component.set("v.hasErrors", false);
$A.get('e.force:refreshView').fire();
//$A.get("e.force:closeQuickAction").fire();
//helper.readCustomField(component, event, helper);
//document.location.reload(true);
helper.hideModal(component, event, helper);
//component.set('v.sObject', {});
if(!component.get('v.fromPlan')){
window.history.back();
}
},
I see that you are refreshing the view on close of modal window, I think that is not required as you are not doing any DML operation on close. If you are looking to nullify the input fields, then you have to add code to nullify the object in the closemodal method of component js.
I am adding code to nullify the date field below
Add this line of code to your method and verify the functionality. you can nullify the entire object in the form instead of a single field, which is a good approach.
component.set("v.sObject", "");
Please test and share the results.
Naveen
Team codengine.in