Created
April 5, 2023 01:24
-
-
Save arahansa/7d13380dec62c3eef52d75ea1fa32531 to your computer and use it in GitHub Desktop.
타임리프에서 input 요소같은 것들도 은근 변경되는 경우가 많아서, component화가 필요했었다는 설명
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--/* | |
인풋 디스플레이 전용 요소 | |
icon : 아이콘 | |
name : 필드명 | |
label : 플레이스 홀더 label | |
maxLength : 길이 | |
*/--> | |
<!--/* BEGIN :: 일반 1,2단 폼 요소 */--> | |
<div class="form-input" th:fragment="writeNV(icon, formName, name, label, maxLength)"> | |
<div class="ic-r-area"></div> | |
<div class="form-group underline-green" | |
th:classappend="${#fields.hasErrors('__${name}__')}? 'border-underline-red'"> | |
<input class="floating-input" | |
type="text" | |
placeholder=" " | |
th:name="${formName}" | |
th:value="*{__${name}__}" | |
th:maxlength="${maxLength}"> | |
<label class="float" th:text="#{${label}}">label</label> | |
</div> | |
<div th:if="${#fields.hasErrors('__${name}__')}" th:errors="*{__${name}__}" class="with-errors"> | |
에러 메시지 | |
</div> | |
</div> | |
<!--/* END :: 일반 1,2단 폼 요소 */--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="form-group col-sm-6"> | |
<label required="true">이름</label> | |
<input th:id="name" type="text" class="form-control" th:field="*{name}" /> | |
<span th:if="${#fields.hasErrors('name')}" th:errors="*{name}" class="error"></span> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment