MM
Mostrar o conteudo de um objeto
Boa tarde a todos.
Como posso mostrar o conteudo de um objeto como por exemplo o ID
Peco para mostrar na tela mas traz em branco echo $this->id traz branco
Obrigado
Classe Cidade
Segue o CidadeForm
function __construct()
{
parent::__construct();
$this->setDatabase('Trade'); // defines the database
$this->setActiveRecord('Cidade'); // defines the active record
// creates the form
$this->form = new TQuickForm('form_Cidade');
$this->form->class = 'tform'; // change CSS class
$this->form = new BootstrapFormWrapper($this->form);
$this->form->style = 'display: table;width:100%'; // change style
// define the form title
$this->form->setFormTitle('Cidade');
// create the form fields
$id = new TEntry('id');
$ds_cidade = new TEntry('ds_cidade');
$cd_ibge = new TEntry('cd_ibge');
$ds_uf = new TEntry('ds_uf');
$country_id = new TSeekButton('country_id');
$ds_pais = new TEntry('ds_pais');
// echo $this->id = $object['id'];
$country_id->setAction(new TAction(array('PaisSeek', 'onReload')));
$cd_ibge->setMask('9999999');
$ds_cidade->setMaxLength(50);
$ds_cidade->forceUpperCase();
$ds_uf->forceUpperCase();
$cd_ibge->setMaxLength(7);
// add the fields
$this->form->addQuickField('Codigo', $id, 50 );
$this->form->addQuickField('Nome', $ds_cidade , 350 );
$this->form->addQuickField('Codigo IBGE', $cd_ibge, 70 );
$this->form->addQuickField('UF', $ds_uf, 30 );
$this->form->addQuickField('Codigo Pais', $country_id, 50 );
$this->form->addQuickField('Nome Pais', $ds_pais, 350 );
$ds_pais->setEditable(FALSE);
if (!empty($id))
{
$id->setEditable(FALSE);
}
Como posso mostrar o conteudo de um objeto como por exemplo o ID
Peco para mostrar na tela mas traz em branco echo $this->id traz branco
Obrigado
Classe Cidade
Segue o CidadeForm
function __construct()
{
parent::__construct();
$this->setDatabase('Trade'); // defines the database
$this->setActiveRecord('Cidade'); // defines the active record
// creates the form
$this->form = new TQuickForm('form_Cidade');
$this->form->class = 'tform'; // change CSS class
$this->form = new BootstrapFormWrapper($this->form);
$this->form->style = 'display: table;width:100%'; // change style
// define the form title
$this->form->setFormTitle('Cidade');
// create the form fields
$id = new TEntry('id');
$ds_cidade = new TEntry('ds_cidade');
$cd_ibge = new TEntry('cd_ibge');
$ds_uf = new TEntry('ds_uf');
$country_id = new TSeekButton('country_id');
$ds_pais = new TEntry('ds_pais');
// echo $this->id = $object['id'];
$country_id->setAction(new TAction(array('PaisSeek', 'onReload')));
$cd_ibge->setMask('9999999');
$ds_cidade->setMaxLength(50);
$ds_cidade->forceUpperCase();
$ds_uf->forceUpperCase();
$cd_ibge->setMaxLength(7);
// add the fields
$this->form->addQuickField('Codigo', $id, 50 );
$this->form->addQuickField('Nome', $ds_cidade , 350 );
$this->form->addQuickField('Codigo IBGE', $cd_ibge, 70 );
$this->form->addQuickField('UF', $ds_uf, 30 );
$this->form->addQuickField('Codigo Pais', $country_id, 50 );
$this->form->addQuickField('Nome Pais', $ds_pais, 350 );
$ds_pais->setEditable(FALSE);
if (!empty($id))
{
$id->setEditable(FALSE);
}
Marcos, você não tem essa informação no construct. Essa informação estará disponível na função onEdit. Veja: