使用Play Framework的JQuery Mobile Form助手

时间:2013-04-17 19:05:02

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

我正在尝试将this播放验证模块与我的应用程序的移动端集成。我想为每个页面使用JQuery mobile而不是Twitter Bootstrap。所以我创建了一个单独的视图,我只是设置了一个基本索引,我试图让登录页面首先工作。登录页面采用了一种形式作为争论,我只是想知道是否有一种方法可以在Play 2.0中使用scala表单助手。*与JQuery Mobile。

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

@(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看起来的样子。

1 个答案:

答案 0 :(得分:2)

是和......不。

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

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

  • 如果只有少数表单,请根据JQM's specification使用常用HTML编写表单。
  • 否则,如果你打算在很多地方使用很多表格,你会做得更好......如果你自己写field constructors

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