Answer the question
In order to leave comments, you need to log in
How to create a successor of CFormModel?
In general, there is such a situation.
There is a form in which the user, for example, talks about his pets (for example, cats).
Example:
Enter description
Enter quantity.
After choosing the quantity, N subforms (identical) appear, where the user fills in the same information, for example:
Name
Breed
Color
Weight
After everything is filled in, there is a button "Add photo" which he can press as many times as he wants and add photos.
The question is how to correctly create a CFormModel successor for such a case and how to display it correctly. As far as I understand, a view with a subform will be loaded by AJAX and displayed, but I don’t really understand what to do with PHP, which will process all this (validate, save, etc.).
Or, this option is also possible: the user does not select the quantity, but simply presses the "Add pet" button as many times as he likes, after which the subform is displayed to him. But, again, all this should be saved in one place, and I think that making the form manually, without using CFormModel, is not a very good choice.
I read about Tabular Input in Yii, but I didn't quite understand how to use it.
Thank you all in advance for your replies.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question