리자

폼 입력값 검사

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,767
16년 전 조회 1,640
17년 전 조회 1,326
17년 전 조회 2,200
17년 전 조회 3,270
17년 전 조회 2,196
17년 전 조회 1,777
17년 전 조회 1,548
17년 전 조회 2,080
17년 전 조회 4,770
17년 전 조회 1,455
17년 전 조회 2,185
17년 전 조회 2,162
17년 전 조회 2,434
17년 전 조회 2,181
17년 전 조회 4,464
17년 전 조회 2,964
17년 전 조회 2,905
17년 전 조회 1,630
17년 전 조회 1,279
17년 전 조회 3,981
17년 전 조회 1,649
17년 전 조회 1,648
17년 전 조회 2,147
17년 전 조회 1,918
17년 전 조회 1,534
17년 전 조회 3,953
17년 전 조회 1,781
17년 전 조회 3,167
17년 전 조회 3,033
17년 전 조회 1,071
17년 전 조회 1,883
17년 전 조회 1,629
17년 전 조회 1,881
17년 전 조회 2,672
17년 전 조회 3,065
17년 전 조회 3,248
17년 전 조회 3,358
17년 전 조회 1,499
17년 전 조회 1,449
17년 전 조회 2,290
17년 전 조회 2,009
17년 전 조회 2,324
17년 전 조회 2,847
17년 전 조회 3,294
17년 전 조회 2,396
17년 전 조회 1,663
17년 전 조회 3,238
17년 전 조회 3,102
17년 전 조회 3,080
17년 전 조회 3,949
17년 전 조회 2,625
17년 전 조회 2,443
17년 전 조회 2,689
17년 전 조회 2,928
17년 전 조회 2,646
17년 전 조회 1,488
17년 전 조회 1,929
17년 전 조회 1,517
17년 전 조회 1,943
17년 전 조회 2,550
17년 전 조회 8,728
17년 전 조회 3,184
17년 전 조회 4,279
17년 전 조회 2,017
17년 전 조회 3,695
17년 전 조회 1,593
17년 전 조회 1,415
17년 전 조회 2,353
17년 전 조회 1,347
17년 전 조회 1,666
17년 전 조회 1,500
17년 전 조회 2,566
17년 전 조회 1,533
17년 전 조회 1,130
17년 전 조회 1,259
17년 전 조회 3,134
17년 전 조회 2,185
17년 전 조회 2,000
17년 전 조회 1,246
17년 전 조회 2,478
17년 전 조회 1,199
17년 전 조회 1,168
17년 전 조회 1,413
17년 전 조회 2,777
17년 전 조회 2,425
17년 전 조회 2,512
17년 전 조회 1,214
17년 전 조회 1,328
17년 전 조회 3,282
17년 전 조회 2,863
17년 전 조회 4,134
17년 전 조회 2,295
17년 전 조회 2,395
17년 전 조회 1,439
17년 전 조회 2,557
17년 전 조회 2,241
17년 전 조회 3,003
17년 전 조회 2,508
17년 전 조회 1,669