자바스크립트 form
330
작성한 질문수 53
타임리프 사용 시,
자바스크립트로 form넘기는거 안되나요?
답변 1
0
안녕하세요. jacomyou님, 공식 서포터즈 David입니다.
가능합니다. 타임리프 템플릿 내에서 자바스크립트를 작성하시면 됩니다.
감사합니다.
0


오류가 아닌 인식을 못하고 있습니다.
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.field-error {
border-color: #dc3545;
color: #dc3545;
}
</style>
<script>
function click(f){
alert("클릭")
}
</script>
</head>
<body>
<form method="post" th:object="${buyer}">
<table border="1px" align="center">
<!-- th:action="@{|/buyerMyPage/buyerChangeSuccess|}"-->
<tr>
<th colspan="4">필수사항</th>
</tr>
<tr>
<th>아이디</th>
<td colspan="4">
<input type="text" th:value="${buyer.getBuyerID()}" th:field="*{buyerID}" readonly
style="background: #6c757d"/>
</td>
</tr>
<tr>
<th>닉네임</th>
<td colspan="4">
<input colspan="4" th:errorclass="field-error" type="text" th:value="${buyer.getNickname()}"
th:field="*{nickname}"/>
<span th:errors="*{nickname}">닉네임 입력</span>
</td>
</tr>
<tr>
<th>휴대번호</th>
<td colspan="4">
<input th:errorclass="field-error" type="text" id="phoneNm0" th:field="*{phoneNm0}" maxlength='3'/> -
<input th:errorclass="field-error" type="text" id="phoneNm1" th:field="*{phoneNm1}" maxlength='4'/> -
<input th:errorclass="field-error" type="text" id="phoneNm2" th:field="*{phoneNm2}" maxlength='4'/>
</td>
</tr>
<tr>
<th>주소</th>
<td colspan="4">
<input th:errorclass="field-error" type="text" th:value="${buyer.getAddress()}" th:field="*{address}"
size="60">
<div th:errors="*{address}">주소 입력</div>
</td>
</tr>
<tr>
<th colspan="4">선택사항</th>
</tr>
<tr>
<th>성별</th>
<td>
<input type="radio" id="f" th:value="F" th:field="*{gender}" th:checked="${buyer.gender eq 'F'}">
<label for="f">여자</label>
</td>
<td colspan="4">
<input type="radio" id="m" th:value="M" th:field="*{gender}" th:checked="${buyer.gender eq 'M'}">
<label for="m">남자</label>
</td>
</tr>
<tr>
<th>키</th>
<td><input type="text" th:value="${buyer.getLength()}" th:field="*{length}"></td>
<th>몸무게</th>
<td><input type="text" th:value="${buyer.getWeight()}" th:field="*{weight}"></td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" id="updateBtn" onclick="click(this.form)" value="수정">
<input type="reset" value="초기화"/>
</td>
</tr>
</table>
</form>
</body>
</html>
0
아래 가이드를 따라 프로젝트를 공유해 주세요.
---
전체 프로젝트를 압축해서 구글 드라이브로 공유해서 링크를 남겨주세요.
구글 드라이브 업로드 방법은 다음을 참고해주세요.
구글 드라이브 업로드 방법 링크
주의: 업로드시 권한 문제 꼭 확인해주세요
추가로 다음 내용도 코멘트 부탁드립니다.
1. 실행 방법을 알려주세요.
2. 어떻게 문제를 확인할 수 있는지 자세한 설명을 남겨주세요.
감사합니다.
이미지 업로드와 db 트랜잭션 묶는법
0
50
1
Could not resolve org.springframework.boot:spring-boot-starter-validation:2.4.4
0
61
2
MessageSourceTest 코드
0
53
1
인터셉터 에러 설정
0
51
1
resolveArgument()메서드 질문
0
59
1
43강 검증1 에서 실패 로직 관련 질문있습니다.
0
64
2
타임리프 3.X 버전 rendering, serializer 에러 해결 방법
2
134
3
스프링 빈에 등록이 안되는거 같은데 어떻게 하면 좋을까요?ㅠㅠ
0
93
3
pdf 오타 문의
0
58
1
ItemUpdateForm 검증 관련 질문입니다.
0
52
1
22page 링크 주소 변경
0
59
2
특정 데이터와 파일을 함께 저장 시, 테이블 구조 질문
0
53
1
섹션3번 수업에 대한 질문입니다.
0
85
2
@Autowired 보다 더 좋은 방법이 어떤 걸까요?
0
87
2
타입컨버터 가 람다랑 비슷해 보이는데 저의 생각이 맞는지?.
0
66
1
자바스크립트 인라인에서 객체 직렬화 시 오류가 납니다
0
143
3
스프링부트 - 오류페이지2 에서 500.html 에서 쓰인 객체 질문
0
66
1
톰캣 에러 페이지가 안보입니다.
0
108
2
apiEceptionController에서 센드 에러 호출하면 안되는지?
0
81
1
세션 타임아웃시 쿠키 삭제 방법이 없나요?
0
120
2
ApiExceptionController 질문드립니다.
0
64
1
셀렉박스 챕터에서 option value에 ==배송 방식 선택== 이것을 넣은 이유가 궁금함, 이렇게 구상해도 되는지?
0
67
1
MemberRepository 필드의 fianl 선언 유무
0
85
2
혹시 index.html 에서는 fragment 사용이 안되는건가요
0
60
1





