如何在播放框架的表单助手中隐藏标签?

How to hide the label in the form helper for the play framework?

我有一个表单,用户可以在其中输入问题。每个字段都有一个标签,但在生产环境中我不想显示标签和某些 inputText 字段。我试图通过使用 'style -> "display: none" 删除 inputText 字段而不是标签来摆脱它们。我在 play framework 网站上没有找到对此的解释:https://www.playframework.com/documentation/2.0.4/JavaFormHelpers

有没有一种方法可以通过内置工具来实现,或者有其他的可能性吗?

@import helper._
@import helper.twitterBootstrap._

@helper.form(action = routes.Application.sendQuestion()){
        <fieldset>
            @helper.inputText(questionForm("questionID"),'style -> "display: none")
            @helper.inputText(questionForm("questionText"))
            @helper.inputText(questionForm("voteScore"))
            @helper.inputText(questionForm("ownerID"))
            @helper.inputText(questionForm("page"))
        </fieldset>
        <input type="submit" class="btn btn-default">
    }

您可以隐藏表单中的标签编写您自己的字段构造函数,例如:

编写您自己的字段构造函数

@(elements: helper.FieldElements)

<div class="@if(elements.hasErrors) {error}">
    <div class="input">
        @elements.input
        <span class="errors">@elements.errors.mkString(", ")</span>
        <span class="help">@elements.infos.mkString(", ")</span> 
    </div>
</div>

更多详情 - https://www.playframework.com/documentation/2.0/JavaFormHelpers