I hate to ask such a general question, and this is not a write the code for me question. I just need some help getting started in the right direction.
I’m going to be doing something similar to this:
http://www.yiiframework.com/doc/guide/1.1/en/form.table
But here is the scenario, my models are lumber products. You can have a 2×4 8′ as one and 2×4 10′ as another. All the way up to 24′. They all have a price field, with a different price. BUT they can be priced by the lineal foot, board foot, thousand board foot.. etc.
So a 2×4 8′ price may be 1.92 and 2×4 10′ price may be 2.40. But you can set the value of prices by passing .24 to both models as the lineal price. So .24 * 8 and .24 * 10. Each lumber model has field called length that can be used here.
Using Yii, and doing it the Yii way… not some work around way like I would think of . What would be the right way to go about linking one CActiveTextField to multiple models. Eg. a group of 2×4 items.
My view with the form would end up looking something like this:
Fir Spruce
2x4 [.24] [ .22]
2x6 [.30] [ .32]
Inbetween [ ] are the input boxes that are linked to multiple models… so the top left would be linked to all 2x4s that are fir
Thanks =p
I don’t know the correct ‘YII way’ but you can update several models from your controller like so: