Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
Pages: 1
Bonjour ,
En fait j'ai un souci concerne l'affichage d'un nom dans un champ Text voilà mon code:
$representative = new Zend_Form_Element_Text('representative'); $representative->setLabel(Zend_Registry::get('Zend_Translate')->translate('representative')) ->setRequired(true) ->addValidator('notEmpty') ->addFilter('StripTags') ->addFilter('StringTrim') //->setOptions(array('class' => 'full-width')) ->setValue(Admin_Models_RepresentativeTools::getRepresentativeNamebyrepresentativecode($this->element->representative)); $representative->getDecorator(('label'))->setOption('tag', 'span'); $this->addElement($representative);
j'ai toujours le numéro pas le nom merci de vous aide.
<div class="row"> <div class="col-md-2"><?php echo $this->element->representative->renderLabel(); ?></div> <div class="col-md-2"><?php echo $this->element->representative->renderViewHelper(); ?></div> </div>
dans le phtml
Merci
Hors ligne
Bonjour,
Que renvoie ta méthode getRepresentativeNamebyrepresentativecode ? Si tu peux montrer le code.
Hors ligne
public static function getRepresentativeNamebyrepresentativecode($representativecode) { if(!empty($representativecode)){ $Representative = new Admin_Model_DbTable_Representative(); $represen = $Representative->fetchRow($Representative->select()->where( self::REPRESENTATIVECODE . ' = ? ', $representativecode)); if(!empty($represen)) {return $represen->representativename;} }
merci de vous aide
Dernière modification par masterphp (28-04-2015 00:58:18)
Hors ligne
Pages: 1