Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Multiple Model Save

$
0
0
Hi Everybody,

I have 2 tables to collect data from: one table is Order(s), I select 1 position from this table, and I have a Product(s) table and I would like to select several positions from this as a list view or similar (best would be a grid because of filtering ability), and the user provides additional data in textfields (amounts) for every product (all in one form). And I would like to save all into a 3rd table (Orders_Products).
What is the best way to save multiple models at once like this, keeping the ability to show validation errors right there where they are generated (right there on the form)?

I can make it work, using the two models Order and Products, but I have a little problem with validation. This way I can't make it to show validation errors right there where they are generated. I mean, for example if a user forgets to provide data for a textfield in only one of the rows regarding Products list, I would like to show validation error right there on the form, but for this, I guess I should include the 3rd model (Orders_Products) also, because in fact it's the validation error for this model, but this seems a little bit too confusing to me (but maybe possible).

Does it make any sense? If yes, what can be a good and most simple solution for this?

Thanks a lot!
BR
c

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>