I have a form model, a login form, with username & password. When the username/password is wrong I'd like to attach an error like "Incorrect user or password" to the model but addError/s only allows error messages that are bound to a field and in this case it doesn't make sense to bound the error to either username or password.
Looking inside the code I don't see any possibility to add unbound error messages. Anyone else felt the need of such error messages?
Thanks,
-soso
Page 1 of 1
Unbound error messages in models
#2
Posted 14 May 2010 - 09:15 AM
soso, on 14 May 2010 - 08:18 AM, said:
I have a form model, a login form, with username & password. When the username/password is wrong I'd like to attach an error like "Incorrect user or password" to the model but addError/s only allows error messages that are bound to a field and in this case it doesn't make sense to bound the error to either username or password.
Looking inside the code I don't see any possibility to add unbound error messages. Anyone else felt the need of such error messages?
Thanks,
-soso
Looking inside the code I don't see any possibility to add unbound error messages. Anyone else felt the need of such error messages?
Thanks,
-soso
Easy peasy. Just pass a blank string as the first argument:
$model->addError('','Invalid user name and/or password');
Share this topic:
Page 1 of 1

Help












