cake-php@googlegroups.com
[Top] [All Lists]

Re: HABTM model fields and Security->disabledFields

Subject: Re: HABTM model fields and Security->disabledFields
From: jeremyharris
Date: Mon, 27 Feb 2012 08:09:36 -0800 PST
You should only need to disable them if they are being manipulated with _javascript_.

That said, I've had issues trying anything other than disabling the entire HABTM data:

$this->Security->disabledFields = array('BusinessHour');

This is because the way Cake compares the fields does not take into account mulitple keys like BusinessHour.0.day, BusinessHour.1.day etc.

On Monday, February 27, 2012 4:41:53 AM UTC-8, randallj wrote:
See the following code:

<?php
// HABTM model fields in view
foreach ($daysOfWeek as $k => $day)
{
   echo $form->input('BusinessHour.'.$k.'.day', array('type' =>
'hidden', 'value' => $k));
}

// Disabling the fields with the Security Component (in controller)?
$this->Security->disabledFields = array('BusinessHour.day');
?>

For HABTM model fields like the ones generated in that foreach loop,
do I disable ALL of those fields via Security->disabledFields in the
controller as I have indicated?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php
<Prev in Thread] Current Thread [Next in Thread>