How to 'unlock' a field in a CakePHP form when it is part of a hasMany association

后端 未结 2 1772
难免孤独
难免孤独 2021-01-21 21:40

I have a form that represents a RewardModifier table in our database. That RewardModifier hasMany RewardOption.

My fo

2条回答
  •  無奈伤痛
    2021-01-21 22:13

    Adding the following to the form code worked for me

    $this->Form->unlockField('User.id');
    

    Unlocking the fields from within the view files also helps declutter the controller's beforeFilter().

    Source: /core-libraries/helpers/form.html#FormHelper::unlockField

提交回复
热议问题