我有conf目錄下的播放框架。CSS到播放框架中的conf/messages
required.message=This field cannot be empty
和模型中,我有:
@Constraints.Required(message = "required.message")
public String name;
我得到正確驗證上的消息。我想要做的是改變消息的顏色。目前,我得到如下:
我要留言「此字段不能爲空」是在紅色。
編輯:
查看代碼
@(customerForm : Form[Customer])
<link rel="stylesheet" media="screen" href="@routes.Assets.at("css/bootstrap.min.css")">
<script src="@routes.Assets.at("js/bootstrap.min.js")" type="text/javascript"></script>
@main("Customer information") {
<h2 style="margin-left: 5%">Customer Information</h2>
@helper.form(action = routes.Customers.save()) {
<fieldset style="margin-left: 5%">
<legend>Adding new customer</legend>
@helper.inputText(customerForm.field("Id"), '_label -> null,'placeholder->"Id")
@helper.inputText(customerForm.field("name"), '_label -> null, 'placeholder->"Name", '_showConstraints -> false)
@helper.inputText(customerForm.field("address"), '_label -> null, 'placeholder->"Address", '_showConstraints -> false)
@helper.inputText(customerForm.field("city"), '_label -> null, 'placeholder->"City", '_showConstraints -> false)
@helper.inputText(customerForm.field("state"), '_label -> null, 'placeholder->"State", '_showConstraints -> false)
@helper.inputText(customerForm.field("postcode"), '_label -> null, 'placeholder->"Postcode", '_showConstraints -> false)
@helper.inputText(customerForm.field("phone"), '_label -> null, 'placeholder->"Phone number", '_showConstraints -> false)
@helper.inputText(customerForm.field("email"), '_label -> null, 'placeholder->"Email", '_showConstraints -> false)
</fieldset>
<input class="btn btn-success" style="margin-left: 5%" type="submit" value="Save"/>
<input class="btn btn-danger" style="margin-left: 5%" onClick="window.location='@routes.Customers.list()';" type="button" value="Cancel"/>
}
}
謝謝!
你可以發佈你的視圖代碼的形式? –
@DanielOlszewski查看編輯過的文章 – Nabin