1 /** 2 * Object formUtil() Form 관련 Util을 제공 합니다.<br> 3 * Form relaged Util 4 * @constructor 5 * @extends Object 6 */ 7 var formUtil = function() { 8 }; 9 10 /** 11 * using onKeyDown Event on input Component 12 * @param {Object} 13 * event value. 14 */ 15 formUtil.onFormKeyDown = function(e) { 16 var ev = window.event || e; 17 var key = ev.which ? ev.which : ev.keyCode; 18 19 if(key == 13) { 20 if(this.blur){ 21 this.blur(); 22 } 23 24 doSearch(); 25 } 26 }; 27 28 /** 29 * check button authority 30 * @param {String} 31 * Button ID 32 */ 33 formUtil.authCheck = function(btnId, msg) { 34 if(WUX.getComponent(btnId).isDisabled() == true) { 35 alert(msg); 36 return false; 37 } 38 if(WUX.getComponent(btnId).isVisible() == false) { 39 alert(msg); 40 return false; 41 } 42 return true; 43 }; 44 45 /** 46 * Combo Box 값이 바뀌었을 때, 지정한 Combo Box의 값을 Setting.<br> 47 * change target combokey 48 * @param param 49 * commonId 바뀌야 할 Combo Box의 commonId - [String]<br> 50 * tartget id 51 * @param voName 52 * comboKey Data를 Setting 해야 할 Combo Box의 Key<br> 53 * target combo key value 54 * @param returnFucLoc 55 * return Function Name (return Function이 필요없으면 null) 56 * @param returnParam 57 * returnParam return Function에 전달 할 Parameter (return Function이 필요없으면 null) 58 */ 59 formUtil.setComboData = function(param, voName, returnFucLoc, returnParam) { 60 61 var store = new WUX.data.Store(); 62 store.setProxy("/wisec/common/commonCombo/getMultiComboValue.wu"); 63 store.setParams(param); 64 store.addValueObject(voName); 65 store.load(function(){ 66 if (returnFucLoc != null) { 67 window[returnFucLoc](returnParam); 68 } 69 }); 70 }; 71 72 /** 73 * Form 전체 Component에 대한 Required를 Setting한다.<br> 74 * set required on entire component in form 75 * @param {Object} 76 * form 77 * @param {Boolean} 78 * bool 79 */ 80 formUtil.setFormRequired = function(form, bool) { 81 var fields = form.getFields(); 82 for ( var i = 0; i < fields.length; i++) { 83 fields[i].setRequired(bool); 84 } 85 }; 86 87 /** 88 * Form 특정 Component에 대한 Required를 Setting한다.<br> 89 * set Require to specific component in form 90 * @param {Object} 91 * form 92 * @param val 93 * @param fieldIds 94 */ 95 formUtil.setComponentsRequired = function(form, val, fieldIds) { 96 for ( var i = 0; i < fieldIds.length; i++) { 97 $C(fieldIds[i]).setRequired(val); 98 } 99 }; 100 101 /** 102 * Multi-Search Condition 필수 function. <, <=, >, >= 과 같은 조회조건시 글자를 입력하면 return. Param is null.<br> 103 * empty hidden field 104 */ 105 //formUtil.cleanSearchTerms = function() { 106 // 107 // if ($C(this.getId()).getValue() == "B" || $C(this.getId()).getValue() == "BE" || $C(this.getId()).getValue() == "S" 108 // || $C(this.getId()).getValue() == "SE") { 109 // var formVal = $C(this.getId().replace("st_", "")).getValue(); 110 // for ( var i = 0; i < formVal.length; i++) { 111 // if (!wiseString.isNumber(formVal)) { 112 // if ("${ses.langCode}" == "KO") { 113 // alert("숫자만 입력할 수 있습니다."); 114 // $C(this.getId().replace("st_", "")).setValue(''); 115 // return; 116 // } else { 117 // alert("You must only enter Numbers."); 118 // $C(this.getId().replace("st_", "")).setValue(''); 119 // return; 120 // } 121 // } 122 // } 123 // } else if ($C(this.getId()).getValue() == "IN" || $C(this.getId()).getValue() == "INN") { 124 // $C(this.getId().replace("st_", "")).setValue(''); 125 // } else if ($C(this.getId()).getValue() == "") { 126 // $C(this.getId().replace("st_", "")).setValue(''); 127 // } 128 //}; 129 130 /** 131 * Multi-Search Condition 사용시 Search Field에서 Popup을 띄우면 Hidden Field의 기존 값을 지운다.<br> 132 * make empty hidden column when call popup 133 * @param {Object} 134 * comp 135 * @param {String} 136 * val Hidden Field의 component name. 137 */ 138 //formUtil.cleanSearchHiddenField = function(comp, val) { 139 // //$C(val).setValue(''); 140 //}; 141 142 /** 143 * Get UX Component's Value<br> 144 * 145 * @param {String} 146 * comp component name 147 */ 148 formUtil.getUxValue = function(componentName) { 149 return WUX.getComponent(componentName).getValue(); 150 }; 151 152 /** 153 * Set to value of UX Component<br> 154 * 155 * @param {String} 156 * comp component name 157 * @param {String} 158 * val value 159 */ 160 formUtil.setUxValue = function(componentName, value) { 161 WUX.getComponent(componentName).setValue(value); 162 }; 163 164 formUtil.copyIntoClipBoard = function(text) { 165 window.clipboardData.setData('Text', text); 166 };