I know the title is bit confused. Sorry for that. Here I am explaining my situation.
I have a table called Event. Created model and generated crud operations. All good. I can create events.
When I click on list of events. I can see my events list.
When I click on a specific event id, I can see all details related to that event.
Here I got an idea. I would like to add a form with just two text fields and a submit button.
When user entered details and click submit, Details has to store in another table with that specific event id.
Could anyone please help me with this?
You can collect this input in the same form of the event.
For collect 2 models in the same form, take a look here.
For collect a main model and many instances of a child model,take a look here.
I don’t want to collect it in the same form.
I would like to collect another table fields when I view the first form.
For example: event table --> Event Model --> event view
In the event view, I can see list of my events. Say I will select one event. I will get a nice table with that specific event.
In this event view page, I would like to add one form. So I want to contribute money to that event, I will provide
remaining fields such as amount as per my requirement.
Hope you will understand my requirement.
I advice you to create the crud for the second model, that you can:
Copy from the second controller the code of create, and paste in the action view.
You have to rename somehow the variable $model for the second model and to send to the view with the first model (for the table).
Copy the code of _form for the second model in the view of the first model.
With a bit of debug you will a form under the view.
I adviced you to put in same form because is a bit strange to mix view and form: form are done for insert data, while view only for see them
Thank you for your response.
I am using http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/ to solve the above issue.
As you suggested not to mix view and form.
But here I have one hurdle.
As above explained I created a Event model --> view --> all good.
Now added a dailog modal for the new table. But the new table has to store current event id.
How can I pass that information?
Could you please suggest me?
Could you please provide your thoughts on the above issue?