Validation
Validation

Hello,
I want to do validation on a filed to disallow special characters like @,#,$. So I tried to use no tags and xss but its still allowing special characters. Please assist
Field::inst( 'name' )
->validator( 'Validate::noTags' )
->validator( 'Validate::xss' ),
This discussion has been closed.
Replies
Those characters aren't either HTML entities nor can they be used for XSS attacks, so those two validators wouldn't pick those characters up.
You probably need to use a custom validator which will check the value (using PHP's
strpos
) for those characters.Regards,
Allan
Thanks