How to find all the required fields and display their lightning-tab[label] to the screen if the field is empty? The user should see which tab to go to if a required field is not filled.
HTML
<lightning-tab id="zzz" label="Results">
<div class="slds-box">
<lightning-radio-group
label="Result rating1"
name="rating1"
value={value}
options={options}
type="button"
required
></lightning-radio-group>
</div>
<div class="slds-box">
<lightning-radio-group
label="Result rating2"
name="rating2"
value={value}
options={options}
type="button"
// Not required
></lightning-radio-group>
</div>
...
</lightning-tab>
<lightning-tab id="abc" label="Time">
<div class="slds-box">
<lightning-textarea
...
</lightning-tab>
JS
handleChange (event) {
let res1 = this.template.querySelector('lightning-radio-group');
console.log("req1 = " + res1)
let res2 = this.template.querySelector('.lightning-radio-group');
console.log("req2 = " + res2)
let res3 = this.template.querySelector('lightning-radio-group[required]');
console.log("req3 = " + res3)
let res4 = this.template.querySelectorAll('lightning-radio-group');
console.log("req4 = " + res4)
let res5 = this.template.querySelectorAll('.lightning-radio-group');
console.log("req5 = " + res5)
let res6 = this.template.querySelectorAll('lightning-radio-group[required]');
console.log("req6 = " + res6)
}
Also, Why is the value "SecureElement" when I use queryselector in Console.log?
req1 = SecureElement: [object HTMLElement]{ key: {"namespace":"c"} }
req2 = null
req3 = null
req4 = SecureNodeList: [object NodeList]{ key: {"namespace":"c"} }
req5 = SecureNodeList: [object NodeList]{ key: {"namespace":"c"} }
req6 = SecureNodeList: [object NodeList]{ key: {"namespace":"c"} }