In my Controller I have some set of data, and some values can not be sent from client (it's not an error in my logic), and I don't modify corresponding fields in database. But I want to throw an error if the value is an empty string.
How can I to do it with standard validators?
Example:
I have table users with 2 fields: username and password. User in his profile can change any of them or both. Profile is written in ExtJS 4 with proxy configured with option writeAllFields: false
, so client sends to server only modified fields.
On server side, if, for example, username not found via
$this->_request->getPost('username')
$this->_getParam('username')
... or something else (it's null), I do not want to validate it and modify it in database.
BUT if user typed an empty string in username field, I want to validate it and show an error to user with text like "username cannot be empty".
How can this be accomplished?