我需要在newSuccess.php模板中設置樣式錯誤消息。 我在配置()這樣寫道:樣式錯誤消息 - symfony
$this->setValidators(array(
'id' => new sfValidatorChoice(array('choices'=>array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
'nome' => new sfValidatorString(array(), array('required' => 'Nome Obrigatório.')),
'email' => new sfValidatorEmail(array(), array('invalid' => 'Email inválido.', 'required' => 'Email Obrigatório')),
'contacto' => new sfValidatorString(array(), array('invalid' => 'Contacto inválido.', 'required' => 'Contacto Obrigatório')),
'servico_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('FeasyServico'))),
'dia' => new sfValidatorDate(array(), array('invalid' => 'Data Inválida.', 'required' => 'Data Obrigatória.')),
'hora' => new sfValidatorTime(array(), array('invalid' => 'Hora Inválida', 'required' => 'Hora Obrigatória.')),
));
等等領域將需要寫在newSuccess.php下面的代碼:
<?php if ($form['nome']->hasError()) { ?>
<span class="erro">
<br>Campo Nome InvÁlido
</span>
<?php } ?>
的問題是,在頁面顯示的消息: (來自newSuccess.php)和一個unstyled(來自configure())。我需要這樣一個東西:或者從configure()中刪除消息,並且只顯示上一個代碼顯示的消息,或者從configure()中創建所創建的錯誤消息的樣式。希望我解釋我的自我。