1.@form
}
2.@inputText(permissionform(“value”),'_label -> Messages(“permission.value”))
3.@inputText(myForm(“username”), 'id -> “username”, 'size -> 30)
4.@inputPassword(myForm(“password”))
注:添加额外的参数只需要使用
'参数名称 -> 值
的方式添加。
所有额外的参数将被添加到生成的HTML,名字的开头用“”字符的除外,加下划线的是保留参数。
保留参数开始用下划线场构造函数的参数
保留参数
'label -> “Custom label”
'id -> “idForTheTopDlElement”
'help -> “Custom help”
'showConstraints -> false
'error -> “Force an error”
'showErrors -> false
'default -> true | “选择菜单权限”
5.
@helper.input(myForm(“username”)) { (id, name, value, args) =>
<input type="date" name="@name" id="@id" @toHtmlArgs(args)>
}
6.@inputDate
7.显示列表参数(假如myForm(“emails”) 是一个数组的会用到
@repeat(myForm(“emails”),min=1) { emailField =>
@inputText(emailField)
}
field = helloForm("color"),
options = options(
"" -> "Default",
"red" -> "Red",
"green" -> "Green",
"blue" -> "Blue"
),
args = '_label -> "Choose a color"
)
选择一个
<option class="blank" value="">选择菜单权限</option> <option value="3">menu.edit</option> <option value="2">menu.add</option> <option value="1">admin.index</option> <option value="6">menu.jsonsave</option> <option value="5">menu.json</option> <option value="4">menu.del</option>
10.@inputFile
11.@inputRadioGroup
Example:
{{{
@inputRadioGroup(
contactForm("gender"),·
options = options("M"->"Male","F"->"Female")
'_label -> "Gender",
'_error -> contactForm("gender").error.map(_.withMessage("select gender")))
*
}}}
12.@textarea
Example:
{{{
@textarea(field = myForm(“address”), args = 'rows -> 3, 'cols -> 50)
}}}
13.@inputRadioGroup
Example:
{{{
@inputRadioGroup(
contactForm("gender"),·
options = options("M"->"Male","F"->"Female")
'_label -> "Gender",
'_error -> contactForm("gender").error.map(_.withMessage("select gender")))
*
}}}
@inputRadioGroup( menuform(“menu.userpermission.id”),options = options(UserPermission.options()),'_label -> “Gender1”,'data_check -> “notBlank”)
生成的代码如下: