리자

폼 입력값 검사

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,763
16년 전 조회 1,638
17년 전 조회 1,322
17년 전 조회 2,194
17년 전 조회 3,264
17년 전 조회 2,187
17년 전 조회 1,770
17년 전 조회 1,541
17년 전 조회 2,073
17년 전 조회 4,761
17년 전 조회 1,446
17년 전 조회 2,177
17년 전 조회 2,158
17년 전 조회 2,427
17년 전 조회 2,175
17년 전 조회 4,460
17년 전 조회 2,956
17년 전 조회 2,897
17년 전 조회 1,626
17년 전 조회 1,271
17년 전 조회 3,975
17년 전 조회 1,642
17년 전 조회 1,641
17년 전 조회 2,145
17년 전 조회 1,910
17년 전 조회 1,526
17년 전 조회 3,948
17년 전 조회 1,776
17년 전 조회 3,163
17년 전 조회 3,029
17년 전 조회 1,063
17년 전 조회 1,877
17년 전 조회 1,623
17년 전 조회 1,874
17년 전 조회 2,668
17년 전 조회 3,059
17년 전 조회 3,245
17년 전 조회 3,355
17년 전 조회 1,491
17년 전 조회 1,443
17년 전 조회 2,284
17년 전 조회 2,009
17년 전 조회 2,319
17년 전 조회 2,844
17년 전 조회 3,289
17년 전 조회 2,388
17년 전 조회 1,658
17년 전 조회 3,230
17년 전 조회 3,093
17년 전 조회 3,074
17년 전 조회 3,943
17년 전 조회 2,619
17년 전 조회 2,435
17년 전 조회 2,685
17년 전 조회 2,922
17년 전 조회 2,640
17년 전 조회 1,483
17년 전 조회 1,922
17년 전 조회 1,512
17년 전 조회 1,942
17년 전 조회 2,540
17년 전 조회 8,720
17년 전 조회 3,178
17년 전 조회 4,274
17년 전 조회 2,011
17년 전 조회 3,688
17년 전 조회 1,585
17년 전 조회 1,410
17년 전 조회 2,349
17년 전 조회 1,343
17년 전 조회 1,660
17년 전 조회 1,491
17년 전 조회 2,562
17년 전 조회 1,525
17년 전 조회 1,121
17년 전 조회 1,254
17년 전 조회 3,130
17년 전 조회 2,183
17년 전 조회 1,997
17년 전 조회 1,242
17년 전 조회 2,474
17년 전 조회 1,196
17년 전 조회 1,156
17년 전 조회 1,404
17년 전 조회 2,772
17년 전 조회 2,416
17년 전 조회 2,506
17년 전 조회 1,208
17년 전 조회 1,326
17년 전 조회 3,276
17년 전 조회 2,857
17년 전 조회 4,127
17년 전 조회 2,292
17년 전 조회 2,389
17년 전 조회 1,436
17년 전 조회 2,551
17년 전 조회 2,237
17년 전 조회 2,999
17년 전 조회 2,505
17년 전 조회 1,665