JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Text Boxes & Inputs › validator.validate() as condition › Reply To: validator.validate() as condition
Hi Dark Beccion,
The validate
function returns true
if all rules are valid you can use this to trigger a function when the validator validates.
However if this doesn’t suit your needs you can set the type="custom"
to the validation rule and to validationCallback
property to call a custom function defined by you.
If the above suggestions don’t suit your needs maybe you can add more context in order to be able to give you the best solution.
function validationCallbackEvenNum(event) {
console.log(event)
const window = document.querySelector('smart-window')
window.close()
}
const rules =[ { input: '#evenInput', message: 'Please enter an even one.', action: 'keyup, blur', type: 'custom', validationCallback: validationCallbackEvenNum },
{ input: '#evenInput', message: 'The even number must be between 20 and 50', action: 'keyup, blur', type: 'range', min: 20, max: 50 },
]
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/