리자

폼 입력값 검사

111.jpg

<style>
.error-message { color:red; font-weight:bold; padding-left:16px; padding-top:5px; float:left; background:url(allow.gif) no-repeat 2px 4px; }
</style>

<script src="<?=$g4[path]?>/js/jquery.js"></script>


<form id='frmjoin' name='frmjoin' method='post' action='join_form_update.php' autocomplete='off'>

<table id='tbl-join' border=1 width=100% cellpadding=4>
<colgroup width=150>
<colgroup width=''>
<colgroup width=300>
<tr style='height:30px;'>
    <td>협력사ID</td>
    <td><?=$member[mb_id]?></td>
    <td>회원아이디와 동일</td>
</tr>
<tr style='height:30px;'>
    <td>E-mail</td>
    <td><?=$member[mb_email]?></td>
    <td>회원정보의 E-mail</td>
</tr>
<tr>
    <td>협력사명</td>
    <td><input type=text name=cp_title class=ed size=40 /><span></span></td>
    <td>회사명 or 이름</td>
</tr>
<tr>
    <td>회원구분</td>
    <td>
        <div id=grp_cp_gubun>
        <input type=radio name=cp_gubun value='개인'> 개인  
        <input type=radio name=cp_gubun value='기업'> 기업
        </div>
    </td>
    <td>개인 or 기업</td>
</tr>
<tr>
    <td>도메인 주소</td>
    <td><input type=text name=cp_domain class=ed size=40 value='http://'></td>
    <td>http://sir.co.kr</td>
</tr>
<tr>
    <td>대표자명</td>
    <td><input type=text name=cp_daepyo class=ed size=40></td>
    <td>대표자명</td>
</tr>
<tr>
    <td>주민등록번호</td>
    <td>
        <div id=grp_cp_jumin>
        <input type=text name=cp_jumin1 class=ed size=17 maxlength=6> - <input type=text name=cp_jumin2 class=ed size=17 maxlength=7>
        </div>
    </td>
    <td>123456-1234567</td>
</tr>
<tr>
    <td>담당자명</td>
    <td><input type=text name=cp_damdang class=ed size=40></td>
    <td>대표자와 같은 경우 동일하게 입력</td>
</tr>
<tr>
    <td>담당자 전화번호</td>
    <td><input type=text name=cp_tel class=ed size=40></td>
    <td>02-123-4567</td>
</tr>
<tr>
    <td>담당자 핸드폰번호</td>
    <td><input type=text name=cp_hp class=ed size=40 readonly title='실명인증으로 입력됩니다.'>
        <input type=button value='실명인증' onclick="jsf__pay(document.order_info)">
       
    </td>
    <td>핸드폰 실명인증시 10원 차감됩니다.</td>
</tr>
<tr>
    <td colspan='3'>판매된 컨텐츠 수수료를 정산 받으실 은행 정보를 입력하십시오.</td>
</tr>
<tr>
    <td>은행명</td>
    <td><input type=text name=cp_bank class=ed size=40></td>
    <td>한국은행</td>
</tr>
<tr>
    <td>계좌번호</td>
    <td><input type=text name=cp_account class=ed size=40></td>
    <td>777-7777-77777</td>
</tr>
<tr>
    <td>예금주명</td>
    <td><input type=text name=cp_yegumju class=ed size=40></td>
    <td>왕대박</td>
</tr>
<tr>
    <td colspan='3'>
        판매될 컨텐츠의 데모사이트가 있다면 정보를 입력하십시오.<br />
        사이트주소, 사용자 아이디/패스워드, 관리자주소, 관리자 아이디/패스워드 등
    </td>
</tr>
<tr>
    <td>데모사이트 정보</td>
    <td><textarea name=cp_demo_site rows=7 class=tx style='width:100%;'></textarea></td>
    <td valign='top'>
        사이트주소<br />
        http://demo.sir.co.kr<br />
        guest / guest1234<br />
        <br />
        관리자주소<br />
        http://demo.sir.co.kr/adm/<br />
        admin / admin7777<br />
    </td>
</tr>
</table>

<p align='center'><input type=submit value='신청서 작성 완료'>

</form>

<script>
var $cursor;

$(document).ready(function() {
    /*
    $('#tbl-register td:nth-child(1)').each(function(index) {
        $(this).css('text-align', 'right');
        $(this).css('padding-right', '10px');
    });


    $('#tbl-register input').each(function(index) {
        $(this).addClass('ed');
    });
    */

    // 입력박스에 포 커스가 있으면 색상을 변경
    //$('#tbl-join input:text, textarea').each(function() { // 이것도 되고 아래것도 되고
    $('#tbl-join').find("input[@type=text], textarea").each(function() {
        $(this).focus(function() {
            $(this).css('background-color', '#ff7');
        });
        $(this).blur(function() {
            $(this).css('background-color', '#fff');
        });
        //$(this).unload = $(this).blur;
    });

    $("input[@name=cp_jumin1]").keyup(function(event) {
        var ekey = event.keyCode;
        if (ekey < 48 || ekey > 57) event.returnValue = false;
        if (ekey == 9 || ekey == 16) return false;
        if ($(this).val().length == 6)
            $("input[@name=cp_jumin2]").focus();
    });

    $("input[@name=cp_jumin2]").keyup(function(event) {
        var ekey = event.keyCode;
        if (ekey < 48 || ekey > 57) event.returnValue = false;
        if (ekey == 9 || ekey == 16) return false;
        if ($(this).val().length == 7)
            $("input[@name=cp_tel]").focus();
    });

    $('#frmjoin').submit(function() {

        $cursor = null;

        var $title = $("input[@name=cp_title]");
        error_message($title, "협력사명을 입력하여 주십시오.");

        var $gubun = $("input[@name=cp_gubun]:checked");
        $("input[@name=cp_gubun]:last").parent().find("span.error-message").remove();
        if (typeof($gubun.val()) == 'undefined') {
            $("<span></span>").addClass("error-message").text("회원구분을 선택하여 주십시오.").appendTo($("input[@name=cp_gubun]:last").parent());
            if ($cursor == null) $cursor = $("input[@name=cp_gubun]:first");
        }


        var $domain = $("input[@name=cp_domain]");
        $domain.parent().find("span.error-message").remove();
        if ($.trim($domain.val()) == '' || $domain.val() == 'http://') {
            $("<span></span>").addClass("error-message").text("도메인 주소를 입력하여 주십시오.").appendTo($domain.parent());
            if ($cursor == null) $cursor = $domain;
        }

        var $daepyo = $("input[@name=cp_daepyo]");
        error_message($daepyo, "대표자명을 입력하여 주십시오.");

        var $jumin1 = $("input[@name=cp_jumin1]");
        var $jumin2 = $("input[@name=cp_jumin2]");
        error_message($jumin2, "주민등록번호 뒤 7자리를 입력하여 주십시오.");
        error_message($jumin1, "주민등록번호 앞 6자리를 입력하여 주십시오.");
        if ($.trim($jumin1.val()) != '' && $.trim($jumin2.val()) != '') {
            if (check_jumin($jumin1.val() + $jumin2.val()) == false) {
                $("<span></span>").addClass("error-message").text("주민등록번호가 올바르지 않습니다.").appendTo($jumin2.parent());
                if ($cursor == null) $cursor = $jumin1;
            }
        }

        var $damdang = $("input[@name=cp_damdang]");
        error_message($damdang, "담당자명을 입력하여 주십시오.");
           
        var $tel = $("input[@name=cp_tel]");
        error_message($tel, "담당자 전화번호를 입력하여 주십시오.");
           
        var $hp = $("input[@name=cp_hp]");
        error_message($hp, "담당자 핸드폰번호로 실명인증 하시기 바랍니다.");

        var $bank = $("input[@name=cp_bank]");
        error_message($bank, "은행명을 입력하여 주십시오.");

        var $account = $("input[@name=cp_account]");
        error_message($account, "계좌번호를 입력하여 주십시오.");

        var $yegumju = $("input[@name=cp_yegumju]");
        error_message($yegumju, "예금주명을 입력하여 주십시오.");
        /*
        $account.parent().find("span.error-message").remove();
        if ($.trim($account.val()) == '') {
            $("<span></span>").addClass("error-message").text("계좌번호를 입력하여 주십시오.").appendTo($account.parent());
            if ($cursor == null) $cursor = $account;
        }
        */

        if ($cursor != null) {
            $cursor.focus().select();
            return false;
        }
       
        alert("OK");
        return false;
    });

    $("#frmjoin input:text:first").focus();

    function error_message(fld, err_msg)
    {
        fld.parent().find("span.error-message").remove();
        if ($.trim(fld.val()) == '') {
            $("<span></span>").addClass("error-message").text(err_msg).appendTo(fld.parent());
            if ($cursor == null) $cursor = fld;
        }
    }
});
</script>

[이 게시물은 관리자님에 의해 2011-10-31 16:55:28 jQuery에서 이동 됨]

첨부파일

111.jpg (49.4 KB)
0회 2008-11-21 20:49
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
16년 전 조회 1,752
16년 전 조회 1,625
17년 전 조회 1,312
17년 전 조회 2,190
17년 전 조회 3,250
17년 전 조회 2,179
17년 전 조회 1,757
17년 전 조회 1,528
17년 전 조회 2,060
17년 전 조회 4,749
17년 전 조회 1,432
17년 전 조회 2,166
17년 전 조회 2,148
17년 전 조회 2,422
17년 전 조회 2,167
17년 전 조회 4,455
17년 전 조회 2,948
17년 전 조회 2,887
17년 전 조회 1,617
17년 전 조회 1,260
17년 전 조회 3,964
17년 전 조회 1,634
17년 전 조회 1,629
17년 전 조회 2,132
17년 전 조회 1,902
17년 전 조회 1,520
17년 전 조회 3,935
17년 전 조회 1,773
17년 전 조회 3,154
17년 전 조회 3,021
17년 전 조회 1,054
17년 전 조회 1,868
17년 전 조회 1,612
17년 전 조회 1,864
17년 전 조회 2,657
17년 전 조회 3,040
17년 전 조회 3,236
17년 전 조회 3,347
17년 전 조회 1,479
17년 전 조회 1,435
17년 전 조회 2,276
17년 전 조회 2,000
17년 전 조회 2,308
17년 전 조회 2,835
17년 전 조회 3,283
17년 전 조회 2,377
17년 전 조회 1,650
17년 전 조회 3,223
17년 전 조회 3,083
17년 전 조회 3,064
17년 전 조회 3,933
17년 전 조회 2,604
17년 전 조회 2,427
17년 전 조회 2,677
17년 전 조회 2,914
17년 전 조회 2,633
17년 전 조회 1,470
17년 전 조회 1,915
17년 전 조회 1,507
17년 전 조회 1,933
17년 전 조회 2,527
17년 전 조회 8,713
17년 전 조회 3,169
17년 전 조회 4,267
17년 전 조회 2,002
17년 전 조회 3,676
17년 전 조회 1,575
17년 전 조회 1,404
17년 전 조회 2,341
17년 전 조회 1,331
17년 전 조회 1,651
17년 전 조회 1,483
17년 전 조회 2,550
17년 전 조회 1,517
17년 전 조회 1,110
17년 전 조회 1,245
17년 전 조회 3,119
17년 전 조회 2,179
17년 전 조회 1,989
17년 전 조회 1,233
17년 전 조회 2,464
17년 전 조회 1,187
17년 전 조회 1,146
17년 전 조회 1,396
17년 전 조회 2,763
17년 전 조회 2,408
17년 전 조회 2,498
17년 전 조회 1,197
17년 전 조회 1,319
17년 전 조회 3,263
17년 전 조회 2,850
17년 전 조회 4,119
17년 전 조회 2,278
17년 전 조회 2,374
17년 전 조회 1,423
17년 전 조회 2,542
17년 전 조회 2,226
17년 전 조회 2,988
17년 전 조회 2,498
17년 전 조회 1,655