CakePHP: add fields to form (dynamically)

前端 未结 2 1701
醉梦人生
醉梦人生 2021-02-02 16:21

I am trying to dynamically add fields to my CakePHP form, but it seems that each method I used had its own downsides which I couldn\'t fix. Here is what I tried:

  1. <
2条回答
  •  情深已故
    2021-02-02 16:48

    in some case this solution:

     var optionCount = $('#poll-options > div').size() + 1;
    

    can override your old data in scenario when cake find existing id (optionCount) in db. if u are adding new data iteration index should be generated by uniq generator..

提交回复
热议问题