在表单元素文本上使用zf2表单注释添加标签

时间:2015-12-14 10:30:32

标签: php forms zend-framework2 annotations doctrine

我在将标签添加到类型为text的表单元素时遇到问题。

我试过了:

.run(function ($rootScope, $window, $state, authService, $http, $timeout, localStorageService) {

  $rootScope.$on('$stateChangeStart', function (e, toState, toParams, fromState, fromParams) {

    if (authService.isLoggedIn()) {
        if (toState.name === "404" && fromState.name === '' && localStorageService.get("LAST_STATE") !== "404") {               
            authService.loadStates($stateProviderRef).then(function () {
                $state.go(localStorageService.get("LAST_STATE"), localStorageService.get("LAST_STATE_PARAMS"));
            });                
        }           
    }

  });

  window.onbeforeunload = function () {
    localStorageService.set("LAST_STATE", $state.current.name);
    localStorageService.set("LAST_STATE_PARAMS", $state.params);
    return null;
  }

})

和此:

/**
 * @var string
 *
 * @ORM\Column(name="username", type="string", length=255, unique=true, nullable=false)
 *
 * @Annotation\Type("Zend\Form\Element\Text")
 * @Annotation\Required({"required":"true" })
 * @Annotation\AllowEmpty(allowEmpty=false)
 * @Annotation\Filter({"name":"StripTags"})
 * @Annotation\Filter({"name":"StringTrim"})
 * @Annotation\Attributes({"id": "username"})
 * @Annotation\Options({"label":"Username", "label_options":{"position":"Zend\Form\View\Helper\FormLabel::APPEND"})
 */
protected $username;

但两个注释都在输入前面呈现标签。有人知道如何在输入后启用渲染吗?

感谢您的帮助。

0 个答案:

没有答案