我在RcProfileTableForm.class.php
中有这个abstract class BaseRcProfileTableForm extends BaseFormPropel
{
public function setup()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'created_at' => new sfWidgetFormDateTime(),
'name' => new sfWidgetFormInputText(),
'password' => new sfWidgetFormInputText(),
'unique_code' => new sfWidgetFormInputText(),
'msisdn' => new sfWidgetFormInputText(),
'profile_pic' => new sfWidgetFormInputText(),
'email' => new sfWidgetFormInputText(),
'age' => new sfWidgetFormInputText(),
)
}
并且表单被调用如下:
<?php
include_partial('form', array('form' => $form));
echo $form->renderGlobalErrors(); ?>
因此在实际页面上显示标签和输入框 我现在需要做的是在msisdn和email的输入框的末尾添加一个“*” *将表示适合这些字段的消息
我怎样才能做到这一点?没有html我可以添加一个,因为整个表单从小部件调用
有什么建议吗? 感谢
答案 0 :(得分:0)
在您的表单(RcProfileTableForm)中,您可以添加自定义标签
class RcProfileTableForm extends BaseRcProfileTableForm
{
public function configure()
{
$this->widgetSchema->setLabels(array(
'email' => 'email*',
}
// If you want to customize widget you can make:
$this->widgetSchema['email'] = new sfWidgetFormInputText(array(), array("style"=>'width: 290px;'));
));
// UPADATE
阅读this
所以你必须在apps / frontend / yourmodules / template / _form.php中自定义你的表单部分
在_form.php中我认为你现在有这样的事情:
<强> 强> 你可以:
<?php echo $form['email']->renderError(); ?>
<?php echo $form['email']->render() ?> <?php echo __("Email*"); ?>
//or
<?php echo $form['email']->render() ?> $form['email']->renderLabel() ?>