Custom Validation Web form

Hi All,

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

	//Phone number

		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