开发者

symfony 1.2 forms renderRow error message problem

Im trying to render a row field in a template with some extra styles, like this:

<?php echo $form['email']->renderRow(array('class' =>开发者_如何转开发; 'text')) ?>    
<?php echo $form['email']->renderError() ?>

The problem occurs when my form doesnt validate on this field... then it displays the error message 2 times!, i.e the renderRow renders one errorMsg string, and the renderError does it again... How can i stop renderRow from displaying the error message?

If I just do this, then it works:

<?php echo $form['email']  ?>

But in that case I cant style the field as I want....

thanks!


I am pretty sure this is also valid for 1.2. Instead of using renderRow, use something like this:

<?php echo $form['FormElementName']->renderLabel() ?> //display form element label
<?php echo $form['FormElementName']->renderError() ?> //display form element error (if exist)
<?php echo $form['FormElementName']->render(array('class' => 'text')); ?>  //display form element

renderRow does them all at once.

EDIT From comments (Flask) - added ->render(array('class' => 'text'));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜