php - NotEqualTo Validation in Zend Framework 2 -


is there notequalto validator in zend framework 2? if not; how can implement notequalto validator in zend framework 2? or there other workarounds?

example
have text field having following attributes
'onfocus'=>'if(value==\'name\'){ value=\'\'}'
'onblur'=>'if(value==\'\'){ value=\'name\'}'

when user submits form without entering name; have validate whether field having value of 'name' , if has; return error.

note:
can't use placeholder attribute client require placeholder text disappear on clicking text field(currently disappears when begin typing).

i have made simple workaround using callback validator follows.

'validators' => array(     array(         'name' => 'zend\validator\callback',         'options' => array(             'callback'=>function($value){                 return $value!='name';             }),         ),     ), ), 

details of callback validator can seen @ following link http://framework.zend.com/manual/2.0/en/modules/zend.validator.set.html#callback


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -