Also
var $validate = array(
    'fieldName1' => array(
        'rule' => 'ruleName', // or: array('ruleName', 'param1',
'param2' ...)
        'required' => true,
        'allowEmpty' => false,
        'on' => 'create', // or: 'update'
        'message' => 'Your Error Message'
    )
);

from the book - it is an example validation rule. The 'required' key
if set to false removes the required class name from the input.

On Apr 7, 3:23 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> Ah, of course. I just realised, also, that I can add a CSS rule to
> remove the style inside the edit form.
>
> On Mon, Apr 7, 2008 at 6:14 PM, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote:
>
>
>
> >  $this->Business->validate = array();
>
> >  On Mon, Apr 7, 2008 at 3:22 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> >  >  Does anyone know how to keep FormHelper from adding a "required" class
> >  >  to a form element? I have a model, Business, for which the "name"
> >  >  field is required to validate. On a search form I have the class is
> >  >  being added, causing the CSS style for "required" to be applied.
> >  >  However, the name field is not required for a search.
>
> >  >  FormHelper::input() doesn't appear to offer any way around it:
>
> >  >  if (in_array($this->field(), $this->fieldset['validates'])) {
> >  >     $divOptions = $this->addClass($divOptions, 'required');
> >  >  }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to