[사용자] 맞춤제작 > 맞춤제작 샘플 > 맞춤제작 요청 ==> 입력값 오류 - 스크립트 back 코드 추가
@7ae128f21d76a149e406f7547b6d25ea6453b29f
--- src/main/java/itn/com/cmm/util/StringUtil.java
+++ src/main/java/itn/com/cmm/util/StringUtil.java
... | ... | @@ -26,6 +26,8 @@ |
| 26 | 26 |
import java.util.Date; |
| 27 | 27 |
import java.util.regex.Pattern; |
| 28 | 28 |
|
| 29 |
+import org.apache.commons.lang3.StringUtils; |
|
| 30 |
+ |
|
| 29 | 31 |
public class StringUtil {
|
| 30 | 32 |
|
| 31 | 33 |
private static final int HIGHEST_SPECIAL = '>'; // for escaping html code. by hessie; since 2007/10/01. |
... | ... | @@ -600,4 +602,16 @@ |
| 600 | 602 |
|
| 601 | 603 |
} |
| 602 | 604 |
|
| 605 |
+ |
|
| 606 |
+ public static String getLengthChkAndSubString(String str, int maxLength) {
|
|
| 607 |
+ |
|
| 608 |
+ if (StringUtils.length(str) > maxLength) {
|
|
| 609 |
+ str = StringUtils.substring(str, 0, maxLength); |
|
| 610 |
+ // 잘라낸 문자열을 다시 설정 (필요한 경우) |
|
| 611 |
+ } |
|
| 612 |
+ return str; |
|
| 613 |
+ |
|
| 614 |
+ } |
|
| 615 |
+ |
|
| 616 |
+ |
|
| 603 | 617 |
}(No newline at end of file) |
--- src/main/java/itn/let/mjo/msgCustom/web/MjonMsgCustomWebController.java
+++ src/main/java/itn/let/mjo/msgCustom/web/MjonMsgCustomWebController.java
... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 |
import itn.com.cmm.service.EgovFileMngUtil; |
| 37 | 37 |
import itn.com.cmm.service.FileVO; |
| 38 | 38 |
import itn.com.cmm.util.DateUtils; |
| 39 |
+import itn.com.cmm.util.StringUtil; |
|
| 39 | 40 |
import itn.com.utl.fcc.service.EgovStringUtil; |
| 40 | 41 |
import itn.let.lett.service.HashConfVO; |
| 41 | 42 |
import itn.let.lett.service.LetterService; |
... | ... | @@ -426,6 +427,16 @@ |
| 426 | 427 |
mjonMsgCustomVO.setUserId(userId); |
| 427 | 428 |
mjonMsgCustomVO.setFrstRegisterId(userId); |
| 428 | 429 |
mjonMsgCustomVO.setLastUpdusrId(userId); |
| 430 |
+ |
|
| 431 |
+ |
|
| 432 |
+ // 요청사항 길이 체크 |
|
| 433 |
+ mjonMsgCustomVO.setCustomRequest( |
|
| 434 |
+ StringUtil.getLengthChkAndSubString(mjonMsgCustomVO.getCustomRequest(), 2000) |
|
| 435 |
+ ); |
|
| 436 |
+ |
|
| 437 |
+ |
|
| 438 |
+ |
|
| 439 |
+ |
|
| 429 | 440 |
mjonMsgCustomService.insertMjonMsgCustomInfo(mjonMsgCustomVO); |
| 430 | 441 |
|
| 431 | 442 |
// 법인폰 알람여부 체크 |
--- src/main/webapp/WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp
+++ src/main/webapp/WEB-INF/jsp/web/custom/MsgCustomPopupAjax.jsp
... | ... | @@ -65,7 +65,15 @@ |
| 65 | 65 |
} |
| 66 | 66 |
}); |
| 67 | 67 |
|
| 68 |
- |
|
| 68 |
+ // 요청사항 글자수 제한 |
|
| 69 |
+ $("textarea[name='customRequest']").on('input paste', function() {
|
|
| 70 |
+ var maxLength = 2000; |
|
| 71 |
+ var currentLength = $(this).val().length; |
|
| 72 |
+ |
|
| 73 |
+ if (currentLength > maxLength) {
|
|
| 74 |
+ $(this).val($(this).val().substring(0, maxLength)); |
|
| 75 |
+ } |
|
| 76 |
+ }); |
|
| 69 | 77 |
}); |
| 70 | 78 |
|
| 71 | 79 |
//샘플 이미지 리스트 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?