【问题标题】:JQuery Mobile Form helpers using the Play Framework使用 Play 框架的 JQuery 移动表单助手
【发布时间】:2013-04-17 19:05:02
【问题描述】:

我正在尝试将this play-authenticate 模块与我的应用程序的移动端集成。我想为每个页面使用 JQuery mobile 而不是 Twitter Bootstrap。所以我创建了一个单独的视图,我刚刚设置了一个基本索引,我试图让登录页面首先工作。登录页面以表单为参数,我只是想知道是否有办法在 JQuery Mobile 的 play 2.0.* 中使用 scala 表单助手。

到目前为止我的基本登录页面:

@(loginForm: Form[_])

@import helper._

@main(Messages("playauthenticate.login.title"),"login") {
            <div data-role="content">
                <div data-role="fieldcontain">
                    <label for="textinput1">
                        Your Email
                    </label>
                    <input name="" id="textinput1" placeholder="" value="" type="email" />
                </div>
                <div data-role="fieldcontain">
                    <label for="textinput2">
                        Your Password
                    </label>
                    <input name="" id="textinput2" placeholder="" value="" type="password" />
                </div>
                <a data-role="button" href="#page1">
                    Login Now
                </a>
                <h4>
                    Or login with a different service:
                </h4>
                      @* Display list of available providers *@
                      @_providerPartial(skipCurrent=false)
                <a data-role="button" data-transition="slidedown" href="routes.Application.index()">
                    Home
                </a>
            </div>
}

This 是使用 Twitter Bootstrap 时的样子。

【问题讨论】:

    标签: jquery-mobile playframework-2.0 play-authenticate


    【解决方案1】:

    是的,而且……不。

    正如您向我们展示的那样,jQueryMobile 具有其特定的表单标记,因此 Play 的内置 helpers 无论如何都不适合它...

    您有两种解决方案,您想要使用的选择属于您:

    • 如果您的表单很少,请按照JQM's specification 使用普通 HTML 编写它们。
    • 否则,如果您打算在许多地方使用大量表单,那么您会做得更好,如果您...写自己的field constructors

    当然,如果您决定采用第二种方法,那么如果您决定与他人分享它会很棒:)

    【讨论】:

      猜你喜欢
      • 2013-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-24
      • 2012-09-21
      • 1970-01-01
      • 1970-01-01
      • 2013-05-27
      相关资源
      最近更新 更多