【发布时间】:2013-11-20 06:56:39
【问题描述】:
我正在从事的项目允许登录的用户通过表单添加图像来将图像添加到他们的个人资料中。我想知道是否可以自动传递用户名,以便用户在添加图像时不必输入他的用户名。我想通过让网站自动添加第一个输入文本框来摆脱它。我知道我可以使用 @{session.get("displayName")} 访问它,但不知道如何通过表单传递它。
@main("addimage") {
@helper.form(action = routes.Images.processImageForm) { <!-- <----------**************************----------------->
<fieldset>
<legend>Add My Picture</legend>
@inputText(
addImageForm("creatorUsername"),
'_label -> "Add Name",
'_help -> "Please enter your display name",
'_error -> addImageForm.globalError
)
@inputText(
addImageForm("url"),
'_label -> "Add Image",
'_help -> "Please add your image-url",
'_error -> addImageForm.globalError
)
@inputText(
addImageForm("description"),
'_label -> "Add Description",
'_help -> "Please enter your Description",
'_error -> addImageForm.globalError
)
</fieldset>
<div class="actions">
<input type="submit" class="btn primary" value="Add Image">
<a href="@routes.Application.index" class="btn">Cancel</a>
</div> }
【问题讨论】:
标签: scala playframework