Check If User Has Input A Comma

How can I check if an user has input a comma (,) in a textfield?

Thanks

In a rule? You can use a regular expression:




    array('fieldName', 'match', 'pattern'=>'/,/', 'message'=>'Must contain a comma'),



or the inverse:




    array('fieldName', 'match', 'pattern'=>'/,/', 'not'=>true,

        'message'=>'Must not contain a comma'),



It’s working but it would be like this:




 array('fieldName', 'match', 'pattern'=>'/,/', 'not'=>true, 'message'=>'Must contain a comma'),



or




array('fieldName', 'match', 'pattern'=>'/,/', 'message'=>'Must not contain a comma'),



Thanks.

That doesn’t seem right…

I know. It doesn’t make sense. I’ve tried as you said and it gives me the error message on every field that DOESN’T contain a comma.