1 2$(function() { 3 form_pageLoad(); 4 if (window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager) { 5 var prm = Sys.WebForms.PageRequestManager.getInstance(); 6 prm.add_endRequest(function () { form_pageLoad(); }); 7 } 8}); 9 10function form_pageLoad() { 11 $('.addComment').each(function() { 12 var $this = $(this); 13 if ($this.is("span")) { 14 $this = $this.children(":first"); 15 } 16 var sID = '#' + $this[0].id; //.attr('id'); 17 if ($this.is("input[type='checkbox']") || $this.is("input[type='radio']")) { 18 var arSplits = sID.split('_') 19 var nID = arSplits[arSplits.length - 1]; 20 SetDisplayForCommentBoxOfCheckRadio(sID, nID); 21 $this.click(function() { 22 SetDisplayForCommentBoxOfCheckRadio(sID, nID); 23 }); 24 } else if ($this.is("select")) { 25 SetDisplayForCommentBoxOfSelect(sID, $this.val()); 26 $this.change(function() { 27 SetDisplayForCommentBoxOfSelect(sID, $(this).val()); 28 }); 29 } else if ($(sID + ' input[type="radio"]').length != 0) { 30 $(sID + ' input').each(function() { 31 if ($(this).is(":checked")) { 32 SetDisplayForCommentBoxOfSelect(sID, $(this).val()); 33 } 34 $(this).click(function() { 35 SetDisplayForCommentBoxOfSelect(sID, $(this).val()); 36 }); 37 }); 38 } else if ($(sID + ' input[type="checkbox"]').length != 0) { 39 $(sID + ' input').each(function() { 40 if ($(this).is(":checked")) { 41 var nVal = $(this).parent().attr("customValue"); 42 SetDisplayForCommentBoxOfSelect(sID, nVal); 43 } 44 $(this).click(function() { 45 var bShow = false; 46 $(sID + ' input').each(function() { 47 if ($(this).is(":checked")) { 48 var nVal = $(this).parent().attr("customValue"); 49 bShow = SetDisplayForCommentBoxOfSelect(sID, nVal); 50 if (bShow) { 51 return; 52 } 53 } 54 }); 55 if (!bShow) { 56 $(sID).nextAll('.form-commentBox:first').hide(); 57 //$(sID).nextAll('.hiddenHelper:first').val('0'); 58 } 59 }); 60 }); 61 } 62 }); 63} 64 65function SetDisplayForCommentBoxOfCheckRadio(sID, nVal) { 66 var $parent = $(sID).parent(); 67 if ($(sID).is(":checked") && isCommentRequired("f_" + nVal)) { 68 var id = $parent.nextAll('.form-commentBox:first').show()[0].id; 69 $parent.nextAll('#' + id + 'Display').val('1'); 70 //$parent.nextAll('.hiddenHelper:first').val('1'); 71 } else { 72 var id = $parent.nextAll('.form-commentBox:first').hide()[0].id; 73 $parent.nextAll('#' + id + 'Display').val('0'); 74 //$parent.nextAll('.hiddenHelper:first').val('0'); 75 } 76} 77 78function SetDisplayForCommentBoxOfSelect(sID, nVal) { 79 var $sID = $(sID); 80 var $commentBox = $sID.nextAll('.form-commentBox:first'); 81 var strCommentBoxID = $commentBox[0].id; 82 var $commentBoxDisplay = $sID.nextAll('#' + strCommentBoxID + 'Display'); 83 if (isCommentRequired("o_" + nVal)) { 84 $commentBox.show(); 85 $commentBoxDisplay.val('1'); 86 //$(sID).nextAll('.hiddenHelper:first').val('1'); 87 return true; 88 } else { 89 $commentBox.hide(); 90 $commentBoxDisplay.val('0'); 91 //$(sID).nextAll('.hiddenHelper:first').val('0'); 92 return false; 93 } 94} 95 96function isCommentRequired(sValue) { 97 var sResponse = $.ajax({ 98 url: "/forms/ajax_controls/is_comment_required.ashx?value=" + sValue, 99 async: false 100 }).responseText; 101 if (sResponse == '1') { 102 return true; 103 } 104 return false; 105} 106 107function ValidateComments() { 108 var bValid = true; 109 //clearWater(); 110 $('.errList').html('').hide(); 111 112 $('.commentBox').each(function() { 113 var $this = $(this); 114 if ($this.css('display') != 'none' && $this.val() == '') { 115 $this.focus(); 116 bValid = false; 117 } 118 }); 119 120 if (!bValid) { 121 $('.errList').append('You must explain your selection.<br />').show(); 122 $('html, body').animate({ scrollTop: 0 }, 100); 123 //setupWater(); 124 } 125 return bValid; 126}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.