Hi,

I have a model where a field is required on the Add (create) page but
can be empty on the Modify (update) page.

My model specifies the field should be not-empty on create only, but
the "required" css class (red asterisk) still gets added on the modify
page. How do I make this a non-required field on the modify page?

MODEL:
class Diploma extends AppModel {
var $validate = array(
                'specialite' => array(
                        'notempty' => array(
                                'rule' => array('notempty'),
                                'message' => 'Veuillez saisir la spécialité',
                                'required' => false,
                                'on' => 'create', // Limit validation to 
'create' or 'update'
operations
                        ),
                ),
)
}

On both ADD and EDIT pages (although these are for a parent model):
echo $this->Form->input('Diploma.0.specialite',
array('label'=>__('Spécialité',true),'size'=>40));

The behaviour of the validation rule works correctly when I save but I
just can't get rid of that star!!!

Any help is much appreciated!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to