I have a form with a text field. I don’t want people to enter any kind of link. How can I make sure of that?
Thanks
Dirk
I have a form with a text field. I don’t want people to enter any kind of link. How can I make sure of that?
Thanks
Dirk
Hi Dirk,
you can do this with a custom validation rule on the text field:
^(?)[\s\S]$
The field is valid only if the regex matches, and this one only matches text that contains neither “http:”, “https:” nor “www.”. An empty field still passes, so you can combine it with “Required” if needed. The rule is checked in the browser and again on the server when the form is submitted.
Two things to keep in mind: the check is case-sensitive, so “HTTPS:” or “WWW.” in capitals would pass. And a bare domain like example.com isn’t caught, because that is hard to tell apart from normal text such as the end of a sentence. If you want to cover capitals too, use this variant instead:
^(?)[\s\S]$
Best,
Daniele