我希望根据单选按钮在mymeleaf的输入中添加一个必需的属性。
我的代码目前是:
<div class="form-group row">
<fieldset class="col-md-6">
<legend class="control-label init-font-size">
<span th:text="#{myLabel}"></span>
</legend>
<label th:with="label_key='radio.'+${item}+'.label'" class="radio-inline required" th:id="'lbl_' + test + ${iteration.index}" th:for="'input_' + test + ${iteration.index}" th:each="item, iteration : ${ { 'yes', 'no' } }" >
<input type="radio" required="required" th:id="'input_' + test + ${iteration.index}" th:field="*{test}" th:value="${item}"/>
<span th:text="#{${label_key}}"></span>
</label>
</fieldset>
</div>
<div class="form-group row classTestInfos">
<div class="col-md-6">
<label class="control-label" th:for="testInfos">
<span th:text="#{test.label}"></span>
<a role="button" href="#" data-toggle="collapse" th:attr="'data-target'='#help' + testInfos" class="btn btn-help collapsed" th:title="#{testInfos.title}">
<span class="blank sr-only" th:text="#{testfInfos.title}"></span>
</a>
<span class="text-danger" aria-hidden="true" th:attr="'data-error-required'=#{testInfos.empty}, 'data-error-format'=#{testInfos.format}"></span>
</label>
<div>
<textarea id="testInfos" maxlength="400" class="form-control" th:field="*{testInfos}" aria-invalid="false"/>
</div>
</div>
</div>
如何在单选按钮上选中“是”时,将需要textarea,否则不需要。