我试图将使用flashing传递到html页面的Class属性的值转换为@helper.inputText(FormName(" Product"))
所以我想将@ product.Name中的值输入@helper.inputText(CartForm(" Product"))
这是我的HTML代码:
@(products: List[Product], CartForm: Form[Cart])(implicit flash: Flash, lang: Lang)
@import play.api.Play.current
@import play.api.i18n.Messages
@import play.api.i18n.Messages.Implicits._
@import play.api.mvc.Flash
@import models.{Cart}
@import helper._
@sidebar = {
<ul>
<li><a href= browse >Categories</a></li>
<li><a href="news.asp">Gnomes</a></li>
<li><a href="contact.asp">Tools</a></li>
<li><a href="about.asp">Gardening Supplies</a></li>
<li><a href="about.asp">Outdoor Equipment</a></li>
</ul>
}
@main(Messages("productList.page"))(sidebar){
<div id="pageStart">
</div>
<div style="margin-left: 150px;">
<div id="homeBanner">
<a href= "home.scala.html"><img src="@routes.Assets.versioned("images/banner1.png")" alt="Delivery" style=" padding-bottom: 20px; padding-right: 40px; margin-left: 200px;"/></a>
<a href= "home.scala.html"><img src="@routes.Assets.versioned("images/banner2.png")" alt="Delivery" style=" padding-bottom: 20px; padding-right: 40px;"/></a>
<a href= "home.scala.html"><img src="@routes.Assets.versioned("images/banner3.png")" alt="Delivery" style=" padding-bottom: 20px; padding-right: 40px;"/></a>
</div>
</div>
<div class ="line"></div>
<div id="content">
<div class="container_12">
<div class="title">
<h2 >Our Gallery <a class="button goCart" href="@routes.CartController.list()">My Cart</a></h2>
</div>
<div class="gallery">
@for(product <- products) {
<div class="grid_3">
<a href="@routes.Assets.versioned(product.imgL)" class="gal">
<div class="img_block">
<img src="@routes.Assets.versioned(product.imgS)" alt="" class="img_inner">
</div>
</a>
<div class="response">@Messages("item.added")</div>
@helper.form(action = routes.BrowseController.save) {
<div class="title" name="get">
<dt>Name: @product.Name</dt>
<dt>Description: @product.description</dt>
<dt>Price: @product.price</dt>
@helper.inputText(CartForm("Product"), 'value -> "@product.Name")
@helper.inputText(CartForm("Quantity"))
<input type = "submit" class = "btn-primary" value = '@Messages("add.item")'>
</div>
}
</div>
}
</div>
</div>
</div>
}
你能给予的任何帮助都很棒:)