I’m attempting to customize the error output on the CakePHP 2.0 form helper. Currently, the form renders error messages below the input and applies an ‘error’ class to the input’s label.
I have found that I can either disable error reporting altogether for an input, or output the error class and message.
I would like the error class to be applied to the label of the offending inputs WITHOUT any message below.
How do you turn off the error message outputting for a form, BUT still apply error classes to offending labels?
FormHelper::input()has aformatoption. It is aYou can pass the default format, leaving out the
'error':That should produce the input markup without the error message.
If you want to apply this to multiple inputs in your form, you should keep it DRY:
It is also possible to set the default format for all inputs of a form by passing the format to
FormHelper::create()asinputDefaults: