Martin
Martin

Reputation: 1350

cakephp select field of relationed elements for show in a view

I have this in cakephp, I try choose the field to be displayed in the combobox when creating related data in cake php.

<?php echo $this->Form->create('Round'); ?>
    <fieldset>
        <legend><?php echo __('Add Round'); ?></legend>
    <?php
        echo $this->Form->input('description');
        echo $this->Form->input('text_marked');
        echo $this->Form->input('project_id');
        echo $this->Form->input('User');
    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>

I try select one project with project_title, in the table project, not by 'project_id'. Title are not unique but is more descriptive than id. Can I do this in cake php?

Upvotes: 1

Views: 232

Answers (1)

Martin
Martin

Reputation: 1350

The answer was easy,Thus we choose the field to display in the other views that are associated. it was put:

public $displayField = 'titte'

in the Round model.

Upvotes: 1

Related Questions