Twitter bootstrap twitter引导表单水平排列字段-播放框架

Twitter bootstrap twitter引导表单水平排列字段-播放框架,twitter-bootstrap,playframework,playframework-2.0,Twitter Bootstrap,Playframework,Playframework 2.0,我正在尝试使用twitter引导框架构建一个form-in-play框架 我想在多行中排列控件。我还想得到bootstrap提供的验证消息。有办法做到这一点吗 <form class="form"> @**** * This works *****@ <div class="controls controls-row"> <input type="text" id="inputWarning" placeholde

我正在尝试使用twitter引导框架构建一个form-in-play框架

我想在多行中排列控件。我还想得到bootstrap提供的验证消息。有办法做到这一点吗

<form class="form">

    @****
    * This works
    *****@

    <div class="controls controls-row">
        <input type="text" id="inputWarning" placeholder="placeholder">
        <input type="text" id="inputWarning" placeholder="placeholder">
    </div>

    @****
    * Why doesn't this work?
    *****@
    <div class="controls controls-row">
        <div class="control-group warning">
            <label class="control-label" for="inputWarning">Input with warning</label>
            <div class="controls">
                <input type="text" id="inputWarning">
                <span class="help-inline">Something may have gone wrong</span>
            </div>
        </div>
        <div class="control-group warning">
            <label class="control-label" for="inputWarning">Input with warning</label>
            <div class="controls">
                <input type="text" id="inputWarning">
                <span class="help-inline">Something may have gone wrong</span>
            </div>
        </div>
    </div>

</form>

@****
*这很有效
*****@
@****
*为什么这样不行?
*****@
带警告的输入
可能出了什么问题
带警告的输入
可能出了什么问题

您可以使用中所述的
表单水平
类来构建水平表单

Play提供了使表单渲染更容易的功能。不幸的是,Play附带的Twitter引导模板帮助程序不能与水平表单一起使用,并且将无法使用

我认为最好的解决方案是编写自己的引导模板助手,比如f.ex
app/views/twitterBootstrapInput.scala.html

@(elements: helper.FieldElements)  

<div class="control-group @if(elements.hasErrors) {error}">
  @if(elements.label.toString.nonEmpty) { <label class="control-label" for="@elements.id">@elements.label</label> }
  <div class="controls">
  @elements.input

    <p class="help-inline">@elements.infos.mkString(", ")</p>  
}  
    @if(elements.hasErrors) { <p class="help-block">@elements.errors.mkString(", ")</p> }  
  </div>
</div>

谢谢,但我的问题有点不同。使用twitterBootstrapInput字段构造函数,我可以在一行中有一个标签和一个输入。但是,我想做的是在一行中有多个输入框。如果我使用@inputText助手,它会在单独的行上创建每个输入框。
@(args...)

@import helper._
@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.f) } 

@helper.form(routes.myRoute(args), 'class -> "form-horizontal") {
   @select(
     editOptions("highlightStyle"),
     Seq("abc" -> "def", "ghi" -> "jkl"),
     '_label -> "Source style:"
   )
}