728x90
** 시작 전/ 선생님의 부트스트랩 코드와 내거가 다른 이유:
선생님은 3.3.7 버전이고
나는 5.1 버전을 보았기 때문.
부트스트랩에서 버전 변경 가능
1. textarea 태그 사용
예제
<textarea name="Text1" cols="40" rows="5"></textarea>
Multiple lines of input in <input type="text" />
I have this text input in a form: <input type="text" cols="40" rows="5" style="width:200px; height:50px;" name="Text1" id="Text1" value="" /> ...
stackoverflow.com
input은 싱글라인 텍스트 박스이고 - 제목 입력용, 또는 단문 입력
textarea는 멀티라인 텍스트 박스 :) - 게시글 입력용, 또는 장문 입력
2. 부트스트랩에서 폼 레이아웃 고르고, 코드 복붙 후 수정
Forms
Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.
getbootstrap.com
1. compose.ejs
<%- include partials/header.ejs -%>
<h1>Compose</h1>
<form action="/compose" method="post">
<div class="mb-3">
<label for="postTitle" class="form-label">Title</label>
<input type="text" class="form-control" name="postTitle">
<label for="postBody" class="form-label">Content</label>
<textarea class="form-control" name="postBody" cols="30" rows="3"></textarea>
<p></p>
<button type="submit" class="btn btn-primary mb-3" name="button">Publish</button>
</div>
</form>
<%- include partials/footer.ejs -%>
2. app.js
app.post('/compose', function(req, res) {
console.log(req.body.postTitle, req.body.postBody);
})
'프로그래밍 공부 > 백엔드' 카테고리의 다른 글
블로그 만들기: 챌린지11 글로벌변수 array만들고, push 메소드로 입력 히스토리 불러오기 (0) | 2022.03.13 |
---|---|
블로그 만들기: 챌린지10 복수의 key가 들어있는 객체 (0) | 2022.03.13 |
블로그 만들기: 챌린지 8 compose에 작성한 글이 콘솔로그로 출력 (0) | 2022.03.13 |
블로그 만들기: 챌린지 7 /compose 페이지에 input 달기 (0) | 2022.03.13 |
블로그 만들기: 챌린지6 nav bar 메뉴에 href 연결하기 (0) | 2022.03.13 |