CI 묻고 답하기

제목 submit..
글쓴이 씨아이세상 작성시각 2011/11/22 10:47:49
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 17420   RSS

   가입폼을 cI+jquey(ajax) validation로 가입폼을 만들엇는데요..
   흠..sumit이안돼서요
   <input type="button" value="등록"  id="check">
   버튼누르고 submit이 안돼내요
   $('#form').validate({
   ~~
   }) 이거할대는 잘됏는데
 

  $('#check').click(function() {
  ~~
  });
  이거추가하면서 submit이 안돼서여
  ci익숙해질대즘..jquery가 익숙치않내요

  $('#check').submit(function() { <--요로케 바꿔도 안먹구.ㅠ
 

<script type='text/javascript'>
//<![CDATA[
$(document).ready(function() {
 $(".Btn").click(function(){
  var data =$("#id").val();
  
      $.ajax({
        type: "POST",
        url: "/member/ajax_check",
        dataType: "json",
    data:'id='+data,<br />           error: function(data) {<br />     alert(data.result);<br />         <br />         },<br />         <br />   success:function(data){</p> <p>  if(data.error=="00"){<br />    $("input[name='idcheck']").val("00");
        alert(data.result);

   }else{

        alert(data.result);

   } 
       
  }
  
      });
     
  });

 

 $('#form').validate({
  onkeyup: true,
  rules: {
   id: { required:true, minlength:4, maxlength: 20, q_eng:true },
   password: { required:true, minlength : 4, maxlength: 20, q_eng:true },
     /**
   ~~~
   **/

  },
  messages: {
   id: { required:'아이디를 입력하세요.', minlength:'최소 4자 이상 입력하세요.', maxlength:'최대 20자까지만 입력 가능합니다.' },
   password: { required:'비밀번호를 입력하세요.', minlength:'최소 4자 이상 입력하세요.', maxlength:'최대 20자까지만 입력 가능합니다.' },
   /**
   ~~~
   **/

  },
  errorPlacement: function(error, element) {
   error.appendTo(element.parent()).wrap('<div style="color:red;"></div>');
  },


  submitHandler: function(f) {
   f.submit(); //이걸 핸들링해야할거같은데..ㅠㅠ
  }
 });
 

 

 $('#check').click(function() {

  if($('#id').val() == "") {

  alert("아이디를 꼭 입력하세요!!!");

  $('#id').focus();

   return false;

  }

   /**
   ~~~
   **/

  });
 
});
</script>
<form name="form" id="form" action="register_member"  method='post' enctype="multipart/form-data" >
   <input type="hidden" name=idcheck id="idcheck">
   <table align="center" valign="top" cellpadding="1" cellspacing="1" width="600" height="500" border="0" bgcolor="#CCCCCC">
    <tr>
     <td  height="36" bgcolor="white" >
     <p align="center">아이디<font color=red>*</font></p>
     </td>
     <td  height="36" bgcolor="white" > 
     <input type="text"  name="id"  id="userid" size="19" value="{= set_value('id')}" >{= form_error('id')}
     <input type="button" class="Btn" value="중복체크"></button>

   </tr> 
     <tr align=center>
  <td height="36" colspan="2" bgcolor="white" >
  <input type="button" value="등록"  id="check"></td>
     </tr>  
</form>
 

 다음글 파일 include 문의 (3)
 이전글 [초보]모델이나 라이브러리의 사용방법에 관하여 (5)

댓글

변종원(웅파) / 2011/11/22 14:36:09 / 추천 0
  if($('#id').val() == "") { 에서
#id 에 해당하는 부분이 html 소스에 없습니다. 

"#", "." 이 의미하는 것을 다시 한번 잘 보시기 바랍니다.
씨아이세상 / 2011/11/22 15:32:24 / 추천 0

아죄송합니다..
html에서 옴기다 오타낫내요..
id값을 id로 설정된것 많고여
<input type="text" name="id" id="id" size="19" value="{= set_value('id')}" >
<input type="button" value="등록" id="check">
이부분에서 등록누르면 암현상도 안나내요..
퐈벅으로바도 오류는안나는데 멈쳣어여..ㅠㅠ

그리고
  $('#check').submit(function() { }
  이렇게 하니

 <input type="submit" value="등록"  id="check"></td>
   $('#check').submit(function() {
 
  if($('#id').val() == "") {
 
  alert("아이디를 꼭 입력하세요!!!");
 
  $('#id').focus();
 
   return false;
 
  }
  폼검증이안돼내요..