Salesforce Asked by Oran Jacob on October 4, 2021
The problem is that the date input life cycle is as such:
here is what I mean:
here is my markup:
<lightning-input type="date" name="input5" label="Required date field" required ></lightning-input>
here is a gif:
any workarounds or suggestions how to call onchange before validation occurs ?
You can use reportValidity() function to report validity on change.though dont know why is it happening.
<template>
<lightning-input
type="date"
required
name='input1'
message-when-value-missing="This field is required"
label="enter date"
onchange={handleChange}
></lightning-input>
</template>
and in js
handleChange(){
console.log('change event');
var inp=this.template.querySelector('lightning-input');
if(inp.name='input1'){
inp.reportValidity();
}
}
Correct answer by User6670 on October 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP