2011-04-13 2 views
0

jeditable을 사용하여 양식 유효성 검사를위한 도움말. 제출 된 텍스트와 함께 JSON으로 오류를 전달하기 위해 게시 된 스크립트를 게시하고 싶지만 가능하다면 그 텍스트를 찾아 낼 수 없습니다. 또는 onChange를 통해 입력되는 텍스트를 확인하는 방법.jeditable에 대한 콜백/유효성 검사 팁

들으 여기

+0

훌륭한 솔루션 여기 http://stackoverflow.com/questions/2223747/jeditable-how-to-handle-a-json-response/4611865#4611865 – maxum

답변

0

간단한 샘플이지만, jQuery를 검증를 사용하지.

function isNumeric(value) { 
    if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false; 
    return true; 
} 

$('.edit').editable(your_url, { 
    onsubmit: function(settings, original) { 
     if (isNumeric(original)) { 
      return true; 
     } else { 
      //display your message 
      return false; 
     } 
    } 
});