|
|
@@ -33,7 +33,7 @@
|
|
|
<label class="input_label sr-only">휴대폰 번호</label>
|
|
|
<div class="ui_col_12">
|
|
|
<div class="input_wrap">
|
|
|
- <input type="text" name="recipPhnno" placeholder="휴대폰 번호" class="form_control" minlength="12" maxlength="13" th:value="${deliveryAddrInfo.recipPhnno}"/>
|
|
|
+ <input type="text" name="recipPhnno" placeholder="휴대폰 번호" class="form_control" minlength="11" maxlength="14" th:value="${deliveryAddrInfo.recipPhnno}"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -219,26 +219,34 @@ $("#btn_delivery_modi_save").on("click", function(){
|
|
|
|
|
|
// 유효성체크 함수
|
|
|
var deliveryModifyFormCheck = function() {
|
|
|
- // TODO 유효성 체크 추가
|
|
|
+ let phnno = $('#deliveryModifyForm input[name=recipPhnno]').val();
|
|
|
+ let regExp = /^(050[0-9]|01[016789]|02|0[3-9][0-9])-?[0-9]{3,4}-?[0-9]{4}$/;
|
|
|
+
|
|
|
if (gagajf.isNull($("#deliveryModifyForm input[name=recipNm]").val())) {
|
|
|
mcxDialog.alert("받는분을 입력해주세요.");
|
|
|
$('#deliveryModifyForm input[name=custNm]').focus();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (gagajf.isNull($("#deliveryModifyForm input[name=recipPhnno]").val())) {
|
|
|
+ if (gagajf.isNull(phnno)) {
|
|
|
mcxDialog.alert("휴대폰번호를 입력해주세요.");
|
|
|
$('#deliveryModifyForm input[name=recipPhnno]').focus();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if ($("#deliveryModifyForm input[name=recipPhnno]").val().length < 12) {
|
|
|
+ if (phnno.length < 11) {
|
|
|
mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
|
|
|
$('#deliveryModifyForm input[name=recipPhnno]').focus();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if ($("#deliveryModifyForm input[name=recipPhnno]").val().length > 13) {
|
|
|
+ if (phnno.length > 14) {
|
|
|
+ mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
|
|
|
+ $('#deliveryModifyForm input[name=recipPhnno]').focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!regExp.test(phnno)) {
|
|
|
mcxDialog.alert("휴대폰번호를 정확히 입력해주세요.");
|
|
|
$('#deliveryModifyForm input[name=recipPhnno]').focus();
|
|
|
return false;
|
|
|
@@ -282,7 +290,7 @@ var fnOpenDaumAddr = function() {
|
|
|
}
|
|
|
|
|
|
// 2021.04.09 하이픈처리
|
|
|
-$(document).on("keyup", "#deliveryModifyForm input[name=recipPhnno]", function() {
|
|
|
- $(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") );
|
|
|
+$(document).on("keyup", "#deliveryModifyForm input[name=recipPhnno]", function() {
|
|
|
+ $(this).val( $(this).val().replace(/[^0-9]/g, "").replace(/(^02|^050[0-9]|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3").replace("--", "-") );
|
|
|
});
|
|
|
</script>
|