4
Hello. Through Bake, I created a form to include a Municipality. However, Bake when generating the form, displays the status id and not its name. How do I get the name and not the State ID to appear on it? If possible, I would like to change the label from Uf to State and from nom municipio to municipality.
<div class="municipios form">
<?php echo $this->Form->create('Município'); ?>
<fieldset>
<legend><?php echo __('Incluir Município'); ?></legend>
<?php
echo $this->Form->input('uf_id');
echo $this->Form->input('nom_municipio');
?>
</fieldset>
<?php echo $this->Form->end(__('Enviar')); ?>
</div>
The script used to create the Ufs and Municipios tables is:
DROP TABLE IF EXISTS `ufs`;
CREATE TABLE IF NOT EXISTS `ufs` (
`id` int(10) unsigned NOT NULL COMMENT 'codigo fornecido pelo IBFE',
`nom_estado` varchar(40) DEFAULT NULL COMMENT 'nome do estado',
`sigla` varchar(2) DEFAULT NULL COMMENT 'sigla do estado'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=0;
DROP TABLE IF EXISTS `municipios`;
CREATE TABLE IF NOT EXISTS `municipios` (
`id` varchar(7) NOT NULL COMMENT 'codigo do municipio fornecido pelo IBGE',
`uf_id` int(10) unsigned NOT NULL,
`nom_municipio` varchar(50) NOT NULL COMMENT 'nome do municipio'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=0;
Screen displayed:
You’re the man, thanks...
– Serginho