textarea의 val() 값에 따라 input hidden을 넣고 싶은데요~ 채택완료
lacomparte
8년 전
조회 5,092
댓글 부분입니다.(view_comment.skin.php)
"textarea의 value 값이 비어있으면" 이라는 조건으로 작성한건데요;
제대로 작동하지 않는것 같아서요~
아무래도 조건식이 잘못된것 같습니다 ㅠ
</p><p><?php if(empty($comment)) {</p><p><span class="Apple-tab-span" style="white-space:pre"> </span>echo "<input type='hidden' name='wr_1' value='empty' id='emptyEval'>";</p><p>}?></p><p>
댓글을 작성하려면 로그인이 필요합니다.
답변 3개
채택된 답변
+20 포인트
8년 전
textarea는 name이 wr_content 입니다
그런데 이 값이 없으면 즉 댓글 내용이 없으면 등록이 되지않는 것이 기본 설정인데
무슨 작업을 하려는지 알 수 없네요
하여튼 원하는 내용의 작업은
write_comment_update.head.skin.php 화일을 만들어 아래 코드를 넣으면 됩니다만
위와 같은 이유로 이 화일까지 진행되지않습니다
if(!trim($wr_content) ) $wr_1 = 'empty';
?>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
l
lacomparte
8년 전
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
l
lacomparte
8년 전
조건식은
"만약 textarea의 value 가 빈값인채 submit 이 된다면" 이구요
액션은
"해당 글의 wr_1 필드에 empty 라는 값을 넣어라"
입니다.
input은 view_comment.skin.php의
form 안에 input type="hidden" 마지막에 넣을거예요.
[code]
<form name="fviewcomment" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>" id="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="comment_id" value="<?php echo $c_id ?>" id="comment_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="page" value="<?php echo $page ?>">
<input type="hidden" name="is_good" value="">
<input type="hidden" name="wr_1" value="empty"> // textarea가 빈값이면 이걸 넣으려구요
[/code]
차라리 write_comment_update.php에서
if ($w == 'c') 조건식에서
DB에 insert 해주는게 나을까요?
[code]
if($bo_table == '특정테이블'){
$empty_sql = "INSERT INTO g5_write_특정테이블(wr_1) VALUES('empty') WHERE wr_is_comment = '1'";
$sql = sql_query($empty_sql);
}
[/code]
textarea의 정확한 변수를 잘 모르겠네요;
"만약 textarea의 value 가 빈값인채 submit 이 된다면" 이구요
액션은
"해당 글의 wr_1 필드에 empty 라는 값을 넣어라"
입니다.
input은 view_comment.skin.php의
form 안에 input type="hidden" 마지막에 넣을거예요.
[code]
<form name="fviewcomment" action="./write_comment_update.php" onsubmit="return fviewcomment_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>" id="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="comment_id" value="<?php echo $c_id ?>" id="comment_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="page" value="<?php echo $page ?>">
<input type="hidden" name="is_good" value="">
<input type="hidden" name="wr_1" value="empty"> // textarea가 빈값이면 이걸 넣으려구요
[/code]
차라리 write_comment_update.php에서
if ($w == 'c') 조건식에서
DB에 insert 해주는게 나을까요?
[code]
if($bo_table == '특정테이블'){
$empty_sql = "INSERT INTO g5_write_특정테이블(wr_1) VALUES('empty') WHERE wr_is_comment = '1'";
$sql = sql_query($empty_sql);
}
[/code]
textarea의 정확한 변수를 잘 모르겠네요;
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
이 스킨을 활용한 게시판을 제작했거든요
보시면 원래는 점수와 평가이유를 넣어야 되는데..
저는 평가이유없이도 그냥 가능하게 해놔서요~
(하단 스크립트를 지웠습니다)
[code]
else if (!document.getElementById('wr_content').value)
{
alert("댓글을 입력하여 주십시오.");
return false;
}
[/code]
소스 감사합니다~!
앗, 혹시
search.php 에서 wr_1 이 empty 인건 검색 안되게 하려는데..
[code]
$sql = " select wr_id from {$tmp_write_table} where NOT wr_1 = 'empty' AND {$sql_search} ";
[/code]
이거군요!
댓글 정말 정말 감사드립니다 :D