Skip to content

Commit aedf260

Browse files
committed
use custom validity message on last example
1 parent e715aaf commit aedf260

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ <h2 tabindex="-1" id="success2" class="success" hidden>Your submission was succe
3838
<button value="2" name="form">submit</button>
3939
</form>
4040

41-
<h2>only-validate-on-blur</h2>
41+
<h2>only-validate-on-blur with custom validity messages</h2>
4242
<h2 tabindex="-1" id="success3" class="success" hidden>Your submission was successful</h2>
43-
<form>
43+
<form id="custom2">
4444
<p>All fields marked with * are required</p>
4545

4646
<label for="simple-field2">Desired username*:</label>
@@ -86,7 +86,7 @@ <h2 tabindex="-1" id="success3" class="success" hidden>Your submission was succe
8686
})
8787

8888
form.addEventListener('auto-check-start', () => {
89-
if (form.id === 'custom') {
89+
if (form.id.includes('custom')) {
9090
const {setValidity} = event.detail
9191
setValidity('🔍 Checking validity...')
9292
}
@@ -96,7 +96,7 @@ <h2 tabindex="-1" id="success3" class="success" hidden>Your submission was succe
9696
state.textContent = 'succeeded'
9797
})
9898
form.addEventListener('auto-check-error', event => {
99-
if (form.id === 'custom') {
99+
if (form.id.includes('custom')) {
100100
const {setValidity} = event.detail
101101
setValidity('🚫 Something went wrong. Please try again')
102102
}

0 commit comments

Comments
 (0)