function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } //Type appropriate comment here, and begin script below var pattern = /^[(]?(\d{3})[)]?[-|\s]?(\d{3})[-|\s]?(\d{4})$/; if (!pattern.test(newValue)) { alert('Phone enter a valid phone number'); g_form.setValue('variable_name', ''); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter