加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

playframework-2.0 – Scala Play框架:将表单参数绑定到隐藏字

发布时间:2020-12-16 08:50:26 所属栏目:安全 来源:网络整理
导读:我正在使用Play 2.0.4并在我的 scala模板中使用以下表单. @fieldGroup(field: Field,className: String = "field") = {div class="twipsies well @className" a class="removeField btn danger pull-right"Remove Field/a @inputText( // === I need a hidde
我正在使用Play 2.0.4并在我的 scala模板中使用以下表单.

@fieldGroup(field: Field,className: String = "field") = {
<div class="twipsies well @className">

    <a class="removeField btn danger pull-right">Remove Field</a>

    @inputText( // <=== I need a hidden input field here
        field("id")
    )

    @inputText(
        field("name"),'_label -> "Name",'_help -> "Use lower case,starts with an alphabet can contain numbers and underscores."
    )
}

我需要在表单中隐藏一些字段,如何将其绑定到服务器端Form组件?我在github存储库中看到了@inputHidden模板助手,但它在稳定版本中不可用.我如何完成我要找的东西?谢谢.

解决方法

将其“手动”写为普通HTML:

<input type="hidden" name="id" value='@field("id").value' >

或者使用documentation“处理HTML输入创建”部分中描述的方法.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读