반드시 사진 등록 하도록...

반드시 사진 등록 하도록...

QA

반드시 사진 등록 하도록...

답변 1

본문

아래의 소스에 반드시 사진을 등록하도록 required를 넣었습니다.
사진이 없을시 사진을 넣으라는 메시지가 나옵니다.

사진을 넣고 제출 버튼을 누르면 또 사진을 넣으라고 나옵니다.
이미 사진을 넣었고, 다음 단계인 뷰페이지로 이동을 해야하는데 
이동은 안하고 사진을 넣으라고 하는데 무엇이 문제인지요.
감사합니다. 

            objCell.innerHTML = "<input type='file' required class=tx size=12 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능' style='color:<?=$board[bo_color_6]?>;background-color:<?=$board[bo_color_5]?>;border-color:<?=$board[bo_color_4]?>;border-width:1px;'><br>";



<< 아래는 전체 소스 입니다 >>

              <? if ($is_file) { ?>
              <table width="170" border="0" cellspacing="3" cellpadding="5" bgcolor="#e0e0e0">
                <tr> 
                  <td bgcolor="#FFFFFF" align="center">사진등록 <span onClick="del_file();" style='cursor:pointer;'><img src="<?=$board_skin_path?>/img/up.gif" width="16" height="16" align='absmiddle'></span><span onClick="add_file();" style='cursor:pointer;'><img src="<?=$board_skin_path?>/img/down.gif" width="16" height="16" align='absmiddle'></span></td>
                </tr>
              </table>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td align="center"> 
                    <table id="variableFiles" cellpadding=0 cellspacing=0>
                    </table>
              <?// print_r2($file); ?>
              <script language="JavaScript">
        var flen = 0;
        function add_file(delete_code)
        {
            var upload_count = <?=(int)$board[bo_upload_count]?>;
            if (upload_count && flen >= upload_count)
            {
                alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
                return;
            }
            var objTbl;
            var objRow;
            var objCell;
            if (document.getElementById)
                objTbl = document.getElementById("variableFiles");
            else
                objTbl = document.all["variableFiles"];
            objRow = objTbl.insertRow(objTbl.rows.length);
            objCell = objRow.insertCell(0);
            objCell.innerHTML = "<input type='file' class=tx size=12 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능' style='color:<?=$board[bo_color_6]?>;background-color:<?=$board[bo_color_5]?>;border-color:<?=$board[bo_color_4]?>;border-width:1px;'><br>";
            if (delete_code)
                objCell.innerHTML += delete_code;
            else
            {
                <? if ($is_file_content) { ?>
                objCell.innerHTML += "<br><input type='text' size=12 class=tx name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.' style='width:100%; color:<?=$board[bo_color_6]?>;background-color:<?=$board[bo_color_5]?>;border-color:<?=$board[bo_color_4]?>;border-width:1px;'>";
                <? } ?>
                ;
            }

            flen++;
        }

        <?=$file_script; //수정시에 필요한 스크립트?>

        function del_file()
        {
            // file_length 이하로는 필드가 삭제되지 않아야 합니다.
            var file_length = <?=(int)$file_length?>;
            var objTbl = document.getElementById("variableFiles");
            if (objTbl.rows.length - 1 > file_length)
            {
                objTbl.deleteRow(objTbl.rows.length - 1);
                flen--;
            }
        }
        </script>
                  </td>
                </tr>
              </table>
              <? } ?>
            </td>

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
전체 1
© SIRSOFT
현재 페이지 제일 처음으로