Validation

Validation

sbandasbanda Posts: 5Questions: 1Answers: 0

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' ),

Replies

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    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

  • sbandasbanda Posts: 5Questions: 1Answers: 0

    Thanks

This discussion has been closed.