제목,내용의 필수항목 없이 게시물 등록방법
본문
그누보드를 설치하고
스킨에 있는 스킨중에 만두야님의 예약스킨
(https://sir.kr/g5_skin/8227?sfl=wr_subject%7C%7Cwr_content&stx=%EB%A7%8C%EB%91%90%EC%95%BC)
를 설치하고
약간 변형해서 예약스킨으로 사용을 하려고 합니다.
설치 이용중에 문제가 생겨 도움을 청합니다.
1. 스킨을 설치해서 약간의 변형후 글쓰기 모드는 아래과 같습니다.![]()
2) 문제는 위의 빨간색 직사각형 안에 있는 '제목과 내용'의 필더가 필요가 없어
write.skin.php 에서 삭제를 하고 테스트 했더니
필수항목이라 그런지 '내용을 입력하세요',' 제목을 입력하세요' 라는 글자가 자꾸 뜹니다.
3)참고로
write.skin.php 의 소스는 아래와 같습니다.
-----------------------
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once "mandoo.function.php"; //만두야 스킨 함수 설정 http://mandooya.com
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
<script>
jQuery(function($){
$.datepicker.regional['ko'] = {
closeText: '닫기',
prevText: '이전달',
nextText: '다음달',
currentText: '오늘',
monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
'7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
monthNamesShort: ['1월','2월','3월','4월','5월','6월',
'7월','8월','9월','10월','11월','12월'],
dayNames: ['일','월','화','수','목','금','토'],
dayNamesShort: ['일','월','화','수','목','금','토'],
dayNamesMin: ['일','월','화','수','목','금','토'],
weekHeader: 'Wk',
dateFormat: 'yy-mm-dd',
firstDay: 0,
isRTL: false,
showMonthAfterYear: true,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ko']);
});
</script>
<section id="bo_w">
<h2 id="container_title"><?php echo $g5['title'] ?></h2>
<!-- 게시물 작성/수정 시작 { -->
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?php echo $width; ?>">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<?php
$option = '';
$option_hidden = '';
if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = '';
if ($is_notice) {
$option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>';
}
if ($is_html) {
if ($is_dhtml_editor) {
$option_hidden .= '<input type="hidden" value="html1" name="html">';
} else {
$option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">html</label>';
}
}
if ($is_secret) {
if ($is_admin || $is_secret==1) {
$option .= "\n".'<input type="checkbox" id="secret" name="secret" value="secret" '.$secret_checked.'>'."\n".'<label for="secret">비밀글</label>';
} else {
$option_hidden .= '<input type="hidden" name="secret" value="secret">';
}
}
if ($is_mail) {
$option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>';
}
}
echo $option_hidden;
?>
<div class="tbl_frm01 tbl_wrap">
<table>
<tbody>
<?php if ($is_name) { ?>
<tr>
<th scope="row"><label for="wr_name">이름<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required class="frm_input required" size="10" maxlength="20"></td>
</tr>
<?php } ?>
<?php if ($is_password) { ?>
<tr>
<th scope="row"><label for="wr_password">비밀번호<strong class="sound_only">필수</strong></label></th>
<td><input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?> class="frm_input <?php echo $password_required ?>" maxlength="20"></td>
</tr>
<?php } ?>
<?php if ($is_category) { ?>
<tr>
<th scope="row"><label for="ca_name">분류<strong class="sound_only">필수</strong></label></th>
<td>
<select name="ca_name" id="ca_name" required class="required" >
<option value="">선택하세요</option>
<?php echo $category_option ?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="wr_subject">제목<strong class="sound_only">필수</strong></label></th>
<td>
<div id="autosave_wrapper">
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
<?php if ($is_member) { // 임시 저장된 글 기능 ?>
<script src="<?php echo G5_JS_URL; ?>/autosave.js"></script>
<button type="button" id="btn_autosave" class="btn_frmline">임시 저장된 글 (<span id="autosave_count"><?php echo $autosave_count; ?></span>)</button>
<div id="autosave_pop">
<strong>임시 저장된 글 목록</strong>
<div><button type="button" class="autosave_close"><img src="<?php echo $board_skin_url; ?>/img/btn_close.gif" alt="닫기"></button></div>
<ul></ul>
<div><button type="button" class="autosave_close"><img src="<?php echo $board_skin_url; ?>/img/btn_close.gif" alt="닫기"></button></div>
</div>
<?php } ?>
</div>
</td>
</tr>
<tr>
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
<td class="wr_content">
<?php if($write_min || $write_max) { ?>
<!-- 최소/최대 글자 수 사용 시 -->
<p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
<?php } ?>
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
<?php if($write_min || $write_max) { ?>
<!-- 최소/최대 글자 수 사용 시 -->
<div id="char_count_wrap"><span id="char_count"></span>글자</div>
<?php } ?>
</td>
</tr>
<!-- 만두야닷컴:여기서부터 입력한 내용입니다 -->
<tr>
<th scope="row"><?=mSubj(1);?></th>
<td>
<?=mWrite(1,"radio/3","","")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(2);?></th>
<td>
<?=mWrite(2,"select/1","","width:150px")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(3);?></th>
<td>
<?=mWrite(3,"radio/4","","width:40px")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(4);?></th>
<td>
<?=mWrite(4,"tel","","width:100px")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(5);?></th>
<td>
<?=mWrite(5,"mobile","","width:100px")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(6);?></th>
<td>
<?=mWrite(6,"textarea","","width:600px;height:150px")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(7);?></th>
<td>
<?=mWrite(7,"email","","width:100px;")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(8);?></th>
<td>
<?=mWrite(8,"date/2","","width:80px;")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(9);?></th>
<td>
<?=mWrite(9,"address","","")?>
</td>
</tr>
<tr>
<th scope="row"><?=mSubj(10);?></th>
<td>
<?=mWrite(10,"re_bank","","width:450px")?>
</td>
</tr>
<!-- 만두야닷컴:여기까지입력한 내용입니다 -->
<?php if ($is_guest) { //자동등록방지 ?>
<tr>
<th scope="row">자동등록방지</th>
<td>
<?php echo $captcha_html ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_confirm">
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn_submit">
<a href="./board.php?bo_table=<?php echo $bo_table ?>" class="btn_cancel">취소</a>
</div>
</form>
<script>
<?php if($write_min || $write_max) { ?>
// 글자수 제한
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
check_byte("wr_content", "char_count");
$(function() {
$("#wr_content").on("keyup", function() {
check_byte("wr_content", "char_count");
});
});
<?php } ?>
function html_auto_br(obj)
{
if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
if (result)
obj.value = "html2";
else
obj.value = "html1";
}
else
obj.value = "";
}
function fwrite_submit(f)
{
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
f.wr_subject.focus();
return false;
}
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
if (typeof(ed_wr_content) != "undefined")
ed_wr_content.returnFalse();
else
f.wr_content.focus();
return false;
}
if (document.getElementById("char_count")) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(check_byte("wr_content", "char_count"));
if (char_min > 0 && char_min > cnt) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
}
else if (char_max > 0 && char_max < cnt) {
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
}
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
</script>
</section>
<!-- } 게시물 작성/수정 끝 -->
----------------------------
어느 부문을 수정을 해야
제목과 내용의 필더를 삭제해도 '내용을 입력하세요',' 제목을 입력하세요' 이런 창이뜨지않고
무난하게 글을 입력할 수가 있는지요?
누가 도움을 좀 주시면 고맙겠습니다.
참고로 질문과 답변방에 남겨진 여러가지 방법으로 해도 해결이 잘 되질않아서 입니다.
!-->
답변 2
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
과 wr_content 부분을 찾아서 삭제하신 후에
form 문 안에
t신리님이 말하신 코드 넣으면 됩니다.
신리님
우선 고맙구요.
106라인을 아래와 같이 수정해 봤는데 여전합니다.
<input type="text" hidden name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input required" size="50" maxlength="255">
그리고 컨텐츠는 <input type="...> 이 없어서 어딜 수정해야 하는지요?