리자

폼 입력값 검사

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,769
16년 전 조회 1,644
17년 전 조회 1,327
17년 전 조회 2,202
17년 전 조회 3,273
17년 전 조회 2,196
17년 전 조회 1,777
17년 전 조회 1,548
17년 전 조회 2,083
17년 전 조회 4,770
17년 전 조회 1,455
17년 전 조회 2,185
17년 전 조회 2,162
17년 전 조회 2,434
17년 전 조회 2,182
17년 전 조회 4,466
17년 전 조회 2,967
17년 전 조회 2,906
17년 전 조회 1,632
17년 전 조회 1,282
17년 전 조회 3,984
17년 전 조회 1,653
17년 전 조회 1,651
17년 전 조회 2,149
17년 전 조회 1,921
17년 전 조회 1,534
17년 전 조회 3,954
17년 전 조회 1,785
17년 전 조회 3,168
17년 전 조회 3,037
17년 전 조회 1,074
17년 전 조회 1,883
17년 전 조회 1,631
17년 전 조회 1,882
17년 전 조회 2,674
17년 전 조회 3,065
17년 전 조회 3,252
17년 전 조회 3,362
17년 전 조회 1,499
17년 전 조회 1,452
17년 전 조회 2,290
17년 전 조회 2,010
17년 전 조회 2,324
17년 전 조회 2,848
17년 전 조회 3,296
17년 전 조회 2,396
17년 전 조회 1,666
17년 전 조회 3,241
17년 전 조회 3,104
17년 전 조회 3,081
17년 전 조회 3,951
17년 전 조회 2,626
17년 전 조회 2,445
17년 전 조회 2,690
17년 전 조회 2,929
17년 전 조회 2,647
17년 전 조회 1,490
17년 전 조회 1,930
17년 전 조회 1,519
17년 전 조회 1,948
17년 전 조회 2,551
17년 전 조회 8,730
17년 전 조회 3,187
17년 전 조회 4,283
17년 전 조회 2,018
17년 전 조회 3,697
17년 전 조회 1,594
17년 전 조회 1,417
17년 전 조회 2,356
17년 전 조회 1,348
17년 전 조회 1,670
17년 전 조회 1,501
17년 전 조회 2,566
17년 전 조회 1,534
17년 전 조회 1,131
17년 전 조회 1,259
17년 전 조회 3,139
17년 전 조회 2,188
17년 전 조회 2,001
17년 전 조회 1,249
17년 전 조회 2,479
17년 전 조회 1,202
17년 전 조회 1,169
17년 전 조회 1,415
17년 전 조회 2,778
17년 전 조회 2,428
17년 전 조회 2,515
17년 전 조회 1,217
17년 전 조회 1,331
17년 전 조회 3,285
17년 전 조회 2,865
17년 전 조회 4,137
17년 전 조회 2,297
17년 전 조회 2,400
17년 전 조회 1,446
17년 전 조회 2,559
17년 전 조회 2,244
17년 전 조회 3,005
17년 전 조회 2,510
17년 전 조회 1,670