Forums

Fields validation rules

giulia72 28 Jul, 2022
Hi
I want to customize the field validation rules for email and message as follows:

1- email should not contain more than 3 dots
2 - text area field should not contain any hyperlink

I know it is possible using php code but I'm not a programmer
Colnem 29 Jul, 2022
Hi

What are 3 dots? (Sorry, I'm french). 3 characters?
For the second point, it's very easy. You have to control that field doesn't contain @.
giulia72 29 Jul, 2022
Hi
dots are "."

How I can control if the field doesn't contain @...do you have an example?
Colnem 30 Jul, 2022
You set a variable $address with field email address:

$address=$this->get("field_address", "");


Then you test this variable, something like...
if (strpos($address, '@') !== false) {// The word WAS found}
giulia72 31 Jul, 2022
Hi
I use text area not email.

and where I should insert this code in the Validation tab - custom validation of text area field configuration?
You need to login to be able to post a reply.