파일업로드 JS

This commit is contained in:
KNKIM 2021-07-14 18:28:57 +09:00
parent 45dd39cc83
commit b40a873436
3 changed files with 39 additions and 91 deletions

View File

@ -32,97 +32,9 @@
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> <%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<c:set var="pageTitle">묻고답하기 - 글쓰기</c:set> <c:set var="pageTitle">묻고답하기 - 글쓰기</c:set>
<style> <link rel="stylesheet" href="${pageContext.request.contextPath}/js/fileupload/dropzone.css" />
input:invalid { <link rel="stylesheet" href="${pageContext.request.contextPath}/js/fileupload/style.css" />
border: 2px dashed red; <script src="${pageContext.request.contextPath}/js/fileupload/dropzone.js"></script>
}
input:valid {
border: 2px solid black;
}
input:invalid {
border: 2px dashed red;
}
input:invalid:required {
border: 2px dashed red;
}
input:valid {
border: 2px solid black;
}
</style>
<form>
<label for="choose">Would you prefer a banana or cherry?</label><br/>
<input id="choose1" name="i_like1" oninvalid="InvalidMsg1(this, '잘 입력해요.1');"><br/>
<input id="choose2" name="i_like2" required oninvalid="InvalidMsg2(this, '잘 입력해요.2');"><br/>
<input id="choose3" name="i_like3"><br/>
Satisfaction: <input type="range" size="2" name="satisfaction" min="1" max="5" value="3">
email : <input type="email" id="email" name="email"><br/>
<input id="sssss" name="sssss" required pattern="[Bb]anana"> * Banana or banana<br/>
<div>
<label for="number">How many would you like?</label>
==> <input type="number" id="number" name="amount" value="" min="1" max="10" required oninvalid="InvalidMsg(this, '잘 입력해요.');">
<valid-msg>
Good
</valid-msg>
<invalid-msg>
Good
</invalid-msg>
</div>
<button>Submit</button>
</form>
<script>
function InvalidMsg1(textbox, msg) {
alert("invalid");
if (textbox.value === '') {
textbox.setCustomValidity
(msg);
} else if (textbox.validity.typeMismatch) {
textbox.setCustomValidity
('Please enter an email address which is valid!');
} else {
textbox.setCustomValidity('');
}
return true;
}
function InvalidMsg2(textbox, msg) {
alert("invalid");
if (textbox.value === '') {
textbox.setCustomValidity
(msg);
} else if (textbox.validity.typeMismatch) {
textbox.setCustomValidity
('Please enter an email address which is valid!');
} else {
textbox.setCustomValidity('');
}
return true;
}
function InvalidMsg(textbox, msg) {
alert("invalid");
if (textbox.value === '') {
textbox.setCustomValidity
(msg);
} else if (textbox.validity.typeMismatch) {
textbox.setCustomValidity
('Please enter an email address which is valid!');
} else {
textbox.setCustomValidity('');
}
return true;
}
</script>
<h3>${pageTitle }</h3> <h3>${pageTitle }</h3>
<form:form commandName="reqInfo" <form:form commandName="reqInfo"

View File

@ -130,6 +130,8 @@ $("#jsGrid").jsGrid({
pageNextText: " > ", pageNextText: " > ",
pagerFormat: "{first} {prev} {pages} {next} {last}", pagerFormat: "{first} {prev} {pages} {next} {last}",
/* 이하만 설정 */
data: clients, data: clients,
fields: [ fields: [

View File

@ -0,0 +1,34 @@
<html>
<!--
http://localhost:8080/nlib/fileupload/js/dropzone.css
-->
<meta charset="utf-8">
<link rel="stylesheet" href="/nlib/js/fileupload/dropzone.css" />
<link rel="stylesheet" href="/nlib/js/fileupload/style.css" />
<script src="/nlib/js/fileupload/dropzone.js"></script>
<!--
<link rel="stylesheet" href="https://www.dropzonejs.com/css/dropzone.css?v=1595510599" />
<link rel="stylesheet" href="https://www.dropzonejs.com/css/style.css?v=1595510599" />
<script src="https://www.dropzonejs.com/js/dropzone.js?v=1595510599"></script>
-->
<body>
<div id="dropzone">
<form action="/nlib/fileupload/uploadFile.do"
class="dropzone needsclick" id="myDropzone">
<div class="dz-message needsclick">
<button type="button" class="dz-button">Drop files here or click to select files.</button><br />
<span class="note needsclick">이곳에 파일을 끌어다 놓거나, 클릭하여 올릴 파일을 선택하세요.</span>
</div>
</form>
</div>
</body>
</html>