【发布时间】:2021-04-01 06:19:01
【问题描述】:
我的代码遇到了这个问题,我在这里得到的选择属性不显示来自数据库的值,而是在选择字段中显示第一个选项。 代码如下:
<body>
<g:form controller="customer" action="updateCustomer" class="updateCustomer" id="${cus.id}">
<form>
<div style="width:100%; padding-top: 50px; margin-right: auto; margin-left: auto; text-align: center">
<div style = "height: 50vh; width: 70%; margin-left:auto; margin-right:auto;">
<div>
%{-- Table for customer client--}%
<table class="table table-striped" id="table t1">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th colspan="5" style="height: 40px;>
<h6 style="font-weight: bold; margin-left: 40px;">
<g:link action="index" controller="customer">All Customers</g:link>
>>
<a href="#" onclick="goBack()">${cus.name}</a> >> EDIT
</h6>
</th>
</tr>
<tr>
<th colspan="5" style="height: 40px; text-align:center;background-color:lightseagreen">
<h6 style="font-weight: bold">EDIT CUSTOMER INFORMATION</h6>
</th>
</tr>
<tr style="height: 70px;background-color: #f7fafd;">
<td style = "width:30%;font-weight: bold; text-align: right;padding-right: 20px;"><span class="required">Status:</span></td>
<td style = "width:70%;font-weight: bold; text-align: left; padding-left: 20px;"> <g:select value = "${cus.status}" style = "width:90%" class="form-control" name="status" from="${["Active","Inactive"]}"></g:select></td>
</tr>
</tr>
</thead>
</table>
%{-- End of table for customer client--}%
</div>
</div>
</div>
</form>
</g:form>
在与 HTLM 中的 select 属性等效的
【问题讨论】:
标签: javascript html css grails