Dev/Nodejs
[Nodejs] 글수정하기 - Form
Ellen571
2020. 8. 4. 17:57
반응형
Form에 기존값 출력하기
<form action="/update_process" method="post">
// action : submit했을 때 이동할 주소
<input type="text" name="title" value="${title}">
// 기존 등록되었던 title값 value에 넣어 출력
<textarea name="description">${description}</textarea>
// 기존에 등록되었던 description값 출력
<input type="submit">
</form>
Submit 했을 때 수정할 파일 정보도 전달하기
<form action="/update_process" method="post">
<input type="hidden" name="id" value="${title}">
// submit 클릭시 id로 title값을 전달
// 보여질 필요가 없기에 type은 hidden으로 숨김처리
<input type="text" name="title" value="${title}">
<textarea name="description">${description}</textarea>
<input type="submit">
</form>반응형