【发布时间】:2019-04-13 06:27:47
【问题描述】:
在我的 .gsp 上的 Grails3 项目中,我有一个关系标签,后跟一个使用以下代码的关系 Groovy 文本字段:
<div class="row top-margin">
<!-- RELATIONSHIP LABEL -->
<div class="col-sm-3" style="margin-bottom: 0.1cm">
<label class="control-label col-sm-6" style="font-weight: normal;" for="customerRelationship">
Relationship to Customer (spouse, sibling, stranger, etc.):
</label>
</div>
<!-- RELATIONSHIP INPUT -->
<div class="col-sm-4" style="margin-bottom: 0.1cm">
<g:textField class="form-control" name="customerRelationship" value="${customerRelationship}"
style="width: 200px;"/>
</div>
</div>
我想在 textField 中放置一个“占位符”文本,以便在该字段为空时显示。您可以通过为输入定义占位符值来对 标记执行此操作。
我的最终目标是让标签只显示“与客户的关系:”并移动“配偶、兄弟姐妹、陌生人等”。像占位符一样进入 textField。
我将如何使用
【问题讨论】:
标签: grails input placeholder gsp grails-3.2