리자

폼 입력값 검사

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,759
16년 전 조회 1,632
17년 전 조회 1,316
17년 전 조회 2,192
17년 전 조회 3,258
17년 전 조회 2,182
17년 전 조회 1,762
17년 전 조회 1,536
17년 전 조회 2,066
17년 전 조회 4,757
17년 전 조회 1,437
17년 전 조회 2,171
17년 전 조회 2,152
17년 전 조회 2,425
17년 전 조회 2,173
17년 전 조회 4,457
17년 전 조회 2,953
17년 전 조회 2,892
17년 전 조회 1,621
17년 전 조회 1,265
17년 전 조회 3,970
17년 전 조회 1,639
17년 전 조회 1,635
17년 전 조회 2,138
17년 전 조회 1,907
17년 전 조회 1,523
17년 전 조회 3,944
17년 전 조회 1,773
17년 전 조회 3,159
17년 전 조회 3,025
17년 전 조회 1,059
17년 전 조회 1,873
17년 전 조회 1,618
17년 전 조회 1,869
17년 전 조회 2,661
17년 전 조회 3,053
17년 전 조회 3,241
17년 전 조회 3,351
17년 전 조회 1,485
17년 전 조회 1,440
17년 전 조회 2,280
17년 전 조회 2,003
17년 전 조회 2,313
17년 전 조회 2,840
17년 전 조회 3,286
17년 전 조회 2,381
17년 전 조회 1,656
17년 전 조회 3,228
17년 전 조회 3,090
17년 전 조회 3,071
17년 전 조회 3,938
17년 전 조회 2,609
17년 전 조회 2,430
17년 전 조회 2,682
17년 전 조회 2,920
17년 전 조회 2,637
17년 전 조회 1,480
17년 전 조회 1,918
17년 전 조회 1,510
17년 전 조회 1,939
17년 전 조회 2,533
17년 전 조회 8,718
17년 전 조회 3,174
17년 전 조회 4,273
17년 전 조회 2,005
17년 전 조회 3,681
17년 전 조회 1,582
17년 전 조회 1,410
17년 전 조회 2,347
17년 전 조회 1,340
17년 전 조회 1,654
17년 전 조회 1,489
17년 전 조회 2,555
17년 전 조회 1,522
17년 전 조회 1,116
17년 전 조회 1,251
17년 전 조회 3,124
17년 전 조회 2,179
17년 전 조회 1,995
17년 전 조회 1,236
17년 전 조회 2,470
17년 전 조회 1,195
17년 전 조회 1,152
17년 전 조회 1,402
17년 전 조회 2,765
17년 전 조회 2,412
17년 전 조회 2,501
17년 전 조회 1,202
17년 전 조회 1,322
17년 전 조회 3,270
17년 전 조회 2,855
17년 전 조회 4,124
17년 전 조회 2,286
17년 전 조회 2,383
17년 전 조회 1,431
17년 전 조회 2,547
17년 전 조회 2,232
17년 전 조회 2,995
17년 전 조회 2,502
17년 전 조회 1,661