2010-03-02 8 views
1

jQuery 유효성 플러그인을 사용하고 있습니다. 오류는 다음과 같이 정의 내 오류 용기에 잘 나타납니다jQuery 유효성 검사 플러그인. 포스트 백 후에 errorLabelContainer가 작동하지 않습니다.

$("#aspnetForm").validate({ 

      errorLabelContainer: $("ul", $('div.error-container')), 
      wrapper: 'li', 

      onkeyup: false, 

      rules: { 
       ctl00$Content$dbTurnOverDate$txtDate: { 
        dateISO: true, 
        required: true, 

       }, 
       ctl00$Content$nbAmount$txtNumber: { 
        required: true, 
        number: true 
       }, 
       ctl00$Content$dbPeriodicityStart$txtDate: { 
        dateISO: true 
       }, 
       ctl00$Content$dbPeriodicityStop$txtDate: { 
        dateISO: true 
       }, 
       ctl00$Content$ccTurnoverCategory$txtCategory: { 
        required: true 
       } 


      }, messages: 
       { 
        ctl00$Content$dbTurnOverDate$txtDate:{required: 'Date is required', dateISO: 'Date must be ISO'}, 
        ctl00$Content$nbAmount$txtNumber:{required: 'Amount is required', number: 'Amount must be a valid number'}, 
        ctl00$Content$dbPeriodicityStart$txtDate:{dateISO: 'Date must be ISO'}, 
        ctl00$Content$dbPeriodicityStop$txtDate:{dateISO: 'Date must be ISO'}, 
        ctl00$Content$ccTurnoverCategory$txtCategory:{required: 'Category is required'} 

       }, 

       errorClass: "validationError", validClass: "validationValid", 

     }); 

이 모든 페이지로드에 잘 작동 : 나는 마스터 페이지 내 양식을 가지고,이 같은 내 영문 페이지 중 하나에 내 유효성 검사 규칙을 설정 페이지 상단 : 내 페이지에 다시 게시 할 후

  <div class="error-container"> 
      <ul> 
      </ul> 
     </div> 

문제점 시작 (일부 컨트롤이 그들에 연결된 서버 이벤트가), 그 후 다시 오류가 내 errorLabelContainer에서 렌더링되지 완료 했습니다만, 내 validationError 클래스는 여전히 작동합니다 (입력 주변의 빨간색 프레임).

내 validation 코드를 document.ready 및 pageLoad 함수에 넣으려고했지만 성공하지 못했습니다.

답변

0

흠, 내 errorcontainer를 예상대로 작동하는 업데이트 패널 외부에 배치 한 것처럼 보입니다.

+2

UpdatePanel은 질문에 ** 언급해야 할 ** 것입니다. –

관련 문제