Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7767195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:36:55+00:00 2026-06-01T15:36:55+00:00

I hate to ask such a general question, and this is not a write

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:36:56+00:00Added an answer on June 1, 2026 at 3:36 pm

    I don’t know the correct ‘YII way’ but you can update several models from your controller like so:

       /**
         * Update several models.
         */
        public function actionUpdate()
        {
                // post filtering left out for brevity
                $editFir10 = new Fir10;
                $editFir8 = new Fir8;
                $editFir10->costPerLF=$_POST['firCLF'];
                $editFir8->costPerLF=$_POST['firCLF'];
                $editFir10->save();
                $editFir8->save();
                //here you can send several models AFAIK
                $this->render('update',array(
                        'model1'=>$editFir8,
                        'model2'=>$editFir10,
                ));
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hate to ask such a general question, but the following code is a
I hate giving out my code like this but I'm getting some errors about
I hate to ask such a dumb question, but I'm just starting out, so
I hate ask stupid questions like this, but why doesn't my code do what
I hate to ask this question on this forum, but I'm having a lot
Okay I hate to ask this question ... but here goes. I am writing
I hate to ask another how do you do this with regex question on
I hate to ask the classic question of business logic in database vs code
I hate to ask for help on such a common error but I've been
I hate to ask this question as I am aware that there are plenty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.