cakephp one form, multiple models, not displaying one model's validation messages

前端 未结 2 1115
鱼传尺愫
鱼传尺愫 2020-12-28 18:44

I have a registration form and I am creating a record in both User and Identity tables (a user hasMany identities)

the form looks like this



        
2条回答
  •  礼貌的吻别
    2020-12-28 19:09

    hasMany model's fields should be as array (when combined with parent model), see .0 added between field names

    echo $this->Form->input('Identity.0.name');
    echo $this->Form->input('Identity.0.surname');
    ...
    echo $this->Form->input('Identity.0.email');
    

提交回复
热议问题