-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.html
More file actions
116 lines (112 loc) · 5.58 KB
/
edit.html
File metadata and controls
116 lines (112 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>22100122 김세현 학부생 edit.html화면</title>
<link rel="stylesheet" href="my.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body class="body">
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">OSS</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="visually-hidden">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu" aria-labelledby="dropdown01">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</nav>
<div class="container mt-5">
<h1 class="text-center">Edit Page!</h1>
<form class="form" onsubmit="return validateForm();">
<div class="mb-3">
<label for="category" class="form-label">종류</label>
<p>현재값: 운동</p>
<input type="text" class="form-control" id="category" placeholder="종류를 입력해주세요." >
</div>
<div class="mb-3">
<label for="name" class="form-label">취미명</label>
<p>현재값: 수영</p>
<input type="text" class="form-control" id="name" placeholder="취미명을 입력해주세요.">
</div>
<div class="mb-3">
<label for="cost" class="form-label">비용</label>
<p>현재값: 68,000</p>
<input type="number" class="form-control" id="cost" placeholder="비용을 입력해주세요.">
</div>
<div class="mb-3">
<label for="date" class="form-label">시작날짜</label>
<p>현재값: 2024-03-12</p>
<input type="date" class="form-control" id="date" value="2024-09-30" required>
</div>
<div class="mb-3">
<label for="club" class="form-label">소속</label>
<p>현재값: 동네 초급반</p>
<input type="text" class="form-control" id="club" placeholder="소속을 입력해주세요">
</div>
<div class="mb-3">
<label for="insidepossible" class="form-label">실내 가능여부</label>
<p>현재값: 가능</p>
<select id="insidepossible" class="form-select">
<option value="yes">가능</option>
<option value="no">불가능</option>
</select>
</div>
<div class="text-center">
<div class="text-center">
<button type="submit" class="btn btn-primary" id="confirm">확인</button>
<button type="button" onclick="window.location.href='index.html'" class="btn btn-secondary" id="cancel">취소</button>
</div>
</div>
</form>
</div>
<script>
function validateForm() {
const category = document.getElementById('category').value;
const name = document.getElementById('name').value;
const cost = document.getElementById('cost').value;
const date = document.getElementById('date').value;
const club = document.getElementById('club').value;
if (!category || !name || !cost || !date || !club) {
alert('모든 필드를 채워주세요.');
return false;
}
else if(category.length > 6)
alert("종류값은 6글자를 초과할 수 없습니다.");
// 추가적인 유효성 검사 (예: 비용이 0보다 커야 함)
else if (cost <= 0) {
alert('비용은 0보다 커야 합니다.');
}
else if (new Date(date) < new Date('2010-01-01')){
alert("시작한 날짜는 2010년 이전일 수 없습니다.")
}
else
confirm('게시물을 추가할까요?.');
return true;
}
</script>
</body>
</html>