Zend 2:如何将跨度添加到表单元素?

时间:2019-04-10 19:09:40

标签: html zend-framework2 zend-form

有人可以帮助我吗?

我需要这样的东西:

<div class="form-group">
    <label for="per_cor">
        Correo Electronico <span class="text-danger">*</span>:
    </label>
    <input type="email" name="per_cor" id="per_cor" class="form-control" placeholder="Correo Electronico" value="" required >
</div>

目前,我只完成了此操作:(

如何添加标签 span

<div class="form-group">
    <label for="per_cor">
        Correo Electronico: 
    </label>
    <input name="per_cor" type="text" class="form-control&#x20;" id="per_cor" placeholder="Correo Electronico" required="required" data-parsley-alpha="" value="">
</div>

这是我在Form类中的声明

class FrmPreReg extends Form {
...
$this->add(array(
    "name" => "per_cor",
    "options" => array(
        "label" => "Correo Electronico:"
    ),
    "attributes" => array(
        "type" => "text",
        "class" => "form-control ",
        "id" => "per_cor",
        "placeholder" => "Correo Electronico:",
        "required" => "required",
        "data-parsley-alpha" => "",
    )
));

这是我在HTML中的声明

<div class="form-group">
    <?= $this->formLabel($form->get("per_nom")) ?>
    <?= $this->formElement($form->get("per_nom")) ?>
    <?= $this->formElementErrors()->render($form->get("per_nom"), ['class' => 'help-block']) ?>
</div>

0 个答案:

没有答案