I think I'm not understanding the reference field.
I have a simple form
<?php
class page_prueba extends Page {
function init(){
parent::init();
$p=$this;
$f=$p->add('Form');
$f->setSource('ticket');
$f->addField('line','texto')->validateNotNull();
$f->addField('text','detalle')->validateNotNull();
$c=$p->add('Model_Usuario');
$f->addField('reference','usuario')->setValueList($c)->validateNotNull();
}
}
And I have a User Model
<?php
class Model_Usuario extends Model_Table {
public $entity_code='usuario';
public $table_alias='u';
function defineFields(){
parent::defineFields();
$this->addField('nombre');
$this->addField('password');
$this->addField('email');
$this->addField('telefono');
$this->addField('descripcion');
$this->addField('interno');
$this->addField('esadmin');
}
}
?>
When I run the example page I get on the dropdown (option values) displayed the id values (primary key) but what I want to see on that dropdowns is the name (nombre) field.
Maybe I'm missing something.
Any help would be appreciate.
thanks Alejandro
By default model displays "name" field. There are few ways to customize that
you should probably go after 2, here is example: