Hi,
no, because you are using the wrong section, for validation you need to navigate to the element of the form for which you want setUp validation, then Go Properties and scroll down to the section Validation and select custom, and then insert that code.
Regards,
Mirko