인프런 커뮤니티 질문&답변
셀렉트박스 검증하는법
작성
·
243
1
셀렉트 박스 만들때 input태그와는 다르게 이렇게 하니까 검증 처리가 안되는거 같은데 셀렉트 박스에서 검증 처리하는 방법이 따로 있을까요?
<select th:disabled="${item.stockQuantity eq 0} ? 'disabled'" th:field="*{size}"
th:class="${#fields.hasErrors('size')} ? 'fieldError' : 'asd'">
<option value=" ">-- 사이즈를 선택하세요 --</option>
<!-- 신발일때와 아닐때 사이즈 나누기 -->
<option value="small" th:if="${item.category ne '신발'}">S</option>
<option value="medium" th:if="${item.category ne '신발'}">M</option>
<option value="large" th:if="${item.category ne '신발'}">L</option>
<option value="xlarge" th:if="${item.category ne '신발'}">XL</option>
<option value="xxlarge" th:if="${item.category ne '신발'}">XXL</option>
<option value="230" th:if="${item.category eq '신발'}">230</option>
<option value="240" th:if="${item.category eq '신발'}">240</option>
<option value="250" th:if="${item.category eq '신발'}">250</option>
<option value="260" th:if="${item.category eq '신발'}">260</option>
<option value="270" th:if="${item.category eq '신발'}">270</option>
<option value="280" th:if="${item.category eq '신발'}">280</option>
</select>




