Custom Validation Web form

Hi All,

I am trying to implement validation for webform and I have the below code.

frappe.web_form.after_load=()=>{
	
	//Phone number
	frappe.web_form.on('phone_number',(field,value)=>{

		if(!(CheckSpecialchar(value)==false && CheckAlphabets(value)==false && value.length==10)){
			frappe.throw(__('Invalid mobile number'))
		}
	});

The issue with above method is it will not wait for user to complete the input rather it will start throwing the error on each second idle. is there any way to implement validation which will wait until user finishes his input then validate the field and display the error if any

Thanks!!