2013-04-17 8 views
0

텍스트 필드의 유효성 검사를 제거하는 방법을 이해하지만 라디오 버튼 그룹에 동일한 로직을 적용하면 Spry 유효성 검사가 삭제되지 않습니다. 다음 예에서 라디오 그룹에서 Spry 유효성 검사를 제거하려면 어떻게합니까?

, 당신은 라디오 버튼을 확인하고 사용자가 개인 이외의 것을 선택하는 경우 I는 검증을 파괴하기 위해 노력하고있어 곳.

<script> 
var spryradio1; 

function checkData(){ 
    // get the value 
    document.getElementById("spryradio1").style.display = "none"; 
    var value = document.applicationform.type.options[document.applicationform.type.options.selectedIndex].value; 
    if(value !=""){ 
    if(value == "Individual"){ 

     if(!spryradio1){ 
     spryradio1 = new Spry.Widget.ValidationRadio("spryradio1"); 
     } 

     document.getElementById("spryradio1").style.display = "block"; 

    } else { 


     // if there is a validaiton in sprytextfield destory it, and clear the variable 

     if(spryradio1 && spryradio1.destroy){ 
      spryradio1.resetClasses(); 
      spryradio1.destroy(); 
      spryradio1 = null; 
      } 

     document.getElementById("spryradio1").style.display = "none"; 
    } 
    // proceed with the rest as normal 
    } 
    return true; 
}; 
</script> 
+0

질문에 적절한 언어를 사용하십시오. 아마도'javascript'. 반면에 'validation'은 유용한 태그가 아닙니다. –

+0

감사의 빛. 나는 글을 처음 보았지만 (이 자원을 많이 사용했다). 나는 또한 내 자신의 질문에 대답했다 : – user1899209

+0

을 경우 (spryradio1) { \t \t \t spryradio1.reset(); \t \t \t spryradio1.destroy(); \t \t \t spryradio1 = null; 당신이 당신의 대답을 발견하는 경우 \t \t \t} – user1899209

답변

0

라디오 버튼이 resetClasses 행을 좋아하지 않습니다. SpryValidation은 줄을 바꿀 때 파괴되었습니다.

if(spryradio1) 
{ spryradio1.reset(); 
spryradio1.destroy(); 
spryradio1 = null; }