开发者

Dynamic fields on insert/edit form

let's say that i have 3 tables:

  1. books
  2. properties
  3. book_properties

of course, i would like that when i want to insert new book (or update existing), to fill the form.

fields that exist on form have to be defined as records in table properties.

when i fill up those fields, data has to be saved in table book_p开发者_JS百科roperties.

can you help me by giving some advices and references, how to achieve that?

thank you very much in advance!


You will need to create 3 tables: books (id, author, title, etc.), properties (id, name) and books_properties (id, book_id, property_id, property_value). Notice that the third table must be named books_properties, not book_property. Then you will need to create models for the books and properties tables. See the manual here. Create correct assosiations. Books HasAndBelongsToMany Properties. If you use cake console it will be easier to create models, controllers and views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜