MinsoftK

validation is working

...@@ -24,22 +24,22 @@ ...@@ -24,22 +24,22 @@
24 <div id="article"> 24 <div id="article">
25 <h2>회원가입</h2> 25 <h2>회원가입</h2>
26 <div id="inputset"> 26 <div id="inputset">
27 - <form class="signinform" action="loginmain.html" onsubmit="return checkValidation()" method="post"> 27 + <form class="signinform" action="loginmain.html" onsubmit="return checkValidation()" method="post">
28 <label for="email">이메일:</label><br> 28 <label for="email">이메일:</label><br>
29 - <input id="eValidation"type="text" name="email" placeholder="이메일을 입력하세요." required><br> 29 + <input id="eValidation"type="text" name="email" placeholder="이메일을 입력하세요." ><br>
30 30
31 <label for="password">비밀번호:</label><br> 31 <label for="password">비밀번호:</label><br>
32 - <input id="fValidation" type="password" name="password" placeholder="비밀번호를 입력하세요." required><br> 32 + <input id="fValidation" type="password" name="password" placeholder="비밀번호를 입력하세요." ><br>
33 33
34 <label for="password">비밀번호 확인:</label><br> 34 <label for="password">비밀번호 확인:</label><br>
35 - <input id="sValidation" type="password" name="checkpassword" placeholder="비밀번호를 입력하세요." required><br> 35 + <input id="sValidation" type="password" name="checkpassword" placeholder="비밀번호를 입력하세요." ><br>
36 36
37 37
38 <label for="name">이름:</label><br> 38 <label for="name">이름:</label><br>
39 - <input type="text" name="name"placeholder="이름을 입력하세요." required><br> 39 + <input type="text" name="name"placeholder="이름을 입력하세요." ><br>
40 40
41 <label for="age">나이:</label><br> 41 <label for="age">나이:</label><br>
42 - <input type="text" name="age" placeholder="나이를 입력하세요." required><br><br> 42 + <input type="text" name="age" placeholder="나이를 입력하세요." ><br><br>
43 43
44 <label for="sex">성별:</label><br> 44 <label for="sex">성별:</label><br>
45 <input type="radio" value="man" name="sex">남자<br> 45 <input type="radio" value="man" name="sex">남자<br>
...@@ -57,7 +57,10 @@ ...@@ -57,7 +57,10 @@
57 <input type="checkbox" value="study" name="interesting">공부<br> 57 <input type="checkbox" value="study" name="interesting">공부<br>
58 <input type="checkbox" value="coding" name="interesting">코딩<br><br> 58 <input type="checkbox" value="coding" name="interesting">코딩<br><br>
59 59
60 - <input type="submit" value="회원가입신청"> 60 + <input type="submit" value="회원가입신청" >
61 +
62 +
63 +
61 </form> 64 </form>
62 </div> 65 </div>
63 </div> 66 </div>
......
...@@ -4,7 +4,7 @@ var Email={ ...@@ -4,7 +4,7 @@ var Email={
4 var regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i; 4 var regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i;
5 if(regExp.test(email)){ 5 if(regExp.test(email)){
6 return true; 6 return true;
7 - }else if(email===NULL){ 7 + }else if(email===""){
8 alert("이메일을 입력해주세요!"); 8 alert("이메일을 입력해주세요!");
9 return false; 9 return false;
10 } 10 }
...@@ -19,21 +19,20 @@ var Password={ ...@@ -19,21 +19,20 @@ var Password={
19 checkPassword:function(self){ 19 checkPassword:function(self){
20 var fpassword=document.getElementById('fValidation').value; 20 var fpassword=document.getElementById('fValidation').value;
21 var spassword= document.getElementById('sValidation').value; 21 var spassword= document.getElementById('sValidation').value;
22 - if(fpassword===spassword){ 22 + if(fpassword==="" || spassword===""){
23 - return true;
24 - }else if(fpassword===NULL || spassword===NULL){
25 alert("비밀번호를 입력해주세요!"); 23 alert("비밀번호를 입력해주세요!");
26 return false; 24 return false;
27 - }else { 25 + }else if(fpassword===spassword){
28 - alert("작성한 비밀번호들이 다릅니다!"); 26 + return true;
27 + }else{
28 + alert("입력하신 비밀번호들이 다릅니다!");
29 return false; 29 return false;
30 } 30 }
31 } 31 }
32 } 32 }
33 33
34 function checkValidation(self){ 34 function checkValidation(self){
35 - Email.checkmail(); 35 +
36 - Password.checkPassword();
37 if(Email.checkEmail() && Password.checkPassword() ){ 36 if(Email.checkEmail() && Password.checkPassword() ){
38 return true; 37 return true;
39 }else return false; 38 }else return false;
......