Skip to content

Show Validator Warning Manual - Need Help | Feature #159

@cengizilhan

Description

@cengizilhan

When i focus input and write something, then input validation warnings can be show.
But i need show before it. I tried "form.submit" method but then, its auto focus next input. and i cant solve it yet.
I read the docs but cant found about "trigger validation warnings" there is a solution maybe?

We must be trigger shows errors manually.

edit:
i solved like that.
`
let once = false

function validWarnsTriggerOnce(_input) {
if (once) return
const form = document.getElementById('form_register')
form.addEventListener('submit', function (e) {
e.preventDefault()
if (once) return
once = true
})
form.requestSubmit()
}
function inputsWatcherForWarn() {
const wrap = document.getElementById(pages.registerSubmit.id)
const watchInputs = ['input_name', 'input_lastname']

watchInputs.forEach((inputId) => {
	const _input = wrap.querySelector(`#${inputId}`)
	_input.addEventListener('blur', (e) => {
		e.preventDefault()
		if (_input.value.length >= 3 && !once) {
			validWarnsTriggerOnce(_input)
		}
	})
})

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions