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 7420623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:16:14+00:00 2026-05-29T08:16:14+00:00

in my YII form i have a dropdown depending on a table to another

  • 0

in my YII form i have a dropdown depending on a table to another table which saves the id of the depended table like below

<div class="column">
    <?php echo $form->labelEx($model,'employee'); ?>
<?php echo $form->dropDownList($model,'employee',CHtml::listData(Employee::model()->findAllByAttributes(array('status'=>'Active')),'emp_id','emp_name'),array('empty'=>'select')); ?>
    <?php echo $form->error($model,'employee'); ?>
</div>

from above the form will save emp_id of the emp_name.in grid view also it showing same id only.but i just need to display emp_name of corresponding emp_id and should saved as id in database.anyone have idea post i am new to this thanks in advance

  • 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-05-29T08:16:15+00:00Added an answer on May 29, 2026 at 8:16 am

    In your grid view

    'columns'=>array(
                  ....
    //    'employee',
           array(
                'name'  => 'employee',
                'value' => 'Employee::model()->findByPk($data->employee)->emp_name',
                ),
    

    And if relation to Employee model is defined in your model then you can use

    'value'=>'$data->relation_name->emp_name'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with yii framework forms and I have a form like this: <?php
I have form build with yii framework. The first 2 inputs is first_name and
In my Yii application, I have a model that represents siteconfig table and have
I am doing an application in Yii Framework.I have progressed to some way like
the scenario is i have a form in my Yii project that will take
Suppose in Yii Framework I have the attributes for the model like this field_1
We have 3 websites running on Yii and Zend frameworks and we would like
I have a task form for an application I am building which allows me
I have an active form model which has fields I do not wish to
I'm using yii active records for mysql , and i have a table where

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.