I have a form with a URL field. The default value for this field is http: //. But the field is not required. User can skip it and submit the form. It should not return an error because it is not required, and because they did not enter the URL. But now this is happening, due to http: //.
I heard that I can use beforeValidate () to check if it has http: // and then clear the URL field, which allows me to skip the error message.
But I do not know how to use beforeValidate (). I searched Google, but I did not find working examples. Where to place the code for beforeValidate ()? Is this a function? How do I access the submitted form data?
Thanks.
source share