我有以下表格摘要:
<div class="form-group">
<form:label class="pull-left" path="officeName">Office Name ${isInternational}</form:label>
<form:errors path="officeName" class="error pull-left"></form:errors>
<c:choose>
<c:when test="${isInternational}">
<form:input path="officeName" type="text" class="form-control" id="officeName" placeholder="Enter Office Name"></form:input>
</c:when>
<c:otherwise>
<form:input path="officeName" type="text" class="form-control" id="officeName" placeholder="Enter Office Name" readonly="readonly" ></form:input>
</c:otherwise>
</c:choose>
我总是可以Office Name ${isInternational}
打印适当的值,但无论表单字段是什么启用。感谢。
修改:disabled="disabled" also does not work
答案 0 :(得分:1)
如果您使用的是弹簧,请考虑标签属性可能不同
readonly(false/true)
HTML Optional Attribute. Setting the value of this attribute to 'true' (without the quotes) will disable the HTML element.
http://docs.spring.io/spring/docs/2.0.8/reference/spring-form.tld.html#spring-form.tld.input
我的意思是值必须为真或假,请阅读上面的链接。