테스트 사이트 - 개발 중인 베타 버전입니다

게시판 댓글을 radio button으로 입력하고 싶은데요. 채택완료

소소한여자 4년 전 조회 1,980

 댓글 입력창으로  textarea 아닌 ,라디오 버튼 input type="radio"으로 하고 싶어서 

view_comment.skin 파일 내의 댓글 입력을 아래와 같이 변경을 하였는데

 

2번째 이후 부터는 댓글이 모두 적용이 되어 나오는데

첫번째 라디오 버튼을 체크한  댓글이 표시가 되질 않습니다. 

<input type="radio" id="wr_content" name="wr_content" value="1"<?php echo ($c_wr_content == "1") ? " checked" : "";?> required> 서울 

 

 

</strong></p>

<p>        <label for="wr_content"> <span class="sound_only">지역구</span></label></p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="1"<?php echo ($c_wr_content == "1") ? " checked" : "";?> required> 서울</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="2"<?php echo ($c_wr_content == "2") ? " checked" : "";?> required> 경기도</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="3"<?php echo ($c_wr_content == "3") ? " checked" : "";?> required> 인천</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="4"<?php echo ($c_wr_content == "4") ? " checked" : "";?> required> 세종시</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="5"<?php echo ($c_wr_content == "5") ? " checked" : "";?> required> 강원도</p>

<p> </p>

<p><strong>
 

댓글을 작성하려면 로그인이 필요합니다.

답변 4개

4년 전

</p>

<p> <label for="wr_content_1"> <span class="sound_only">라디오박스</span></label>

            <input type="radio" id="wr_content_1" name="wr_content" value="6"<?php echo ($wr_content == "6") ? " checked" : "";?> required> 순서

            <input type="radio" id="wr_content_2" name="wr_content" value="1"<?php echo ($wr_content == "1") ? " checked" : "";?> required> 1

            <input type="radio" id="wr_content_3" name="wr_content" value="2"<?php echo ($wr_content == "2") ? " checked" : "";?> required> 2

            <input type="radio" id="wr_content_4" name="wr_content" value="3"<?php echo ($wr_content == "3") ? " checked" : "";?> required> 3

            <input type="radio" id="wr_content_5" name="wr_content" value="4"<?php echo ($wr_content == "4") ? " checked" : "";?> required> 4

            <input type="radio" id="wr_content_6" name="wr_content" value="5"<?php echo ($wr_content == "5") ? " checked" : "";?> required> 5

 

 </p>

<p>

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

엑스엠엘
4년 전
radio버튼 마다 id를 다르게 했다는 게 금방 눈이 안 들어 와서 적어 봅니다.

댓글을 작성하려면 로그인이 필요합니다.

브라우저 소스보기"로

해당 부분에 원하시는 대로 html이 나왔는지 확인해 보시고

그랬다면

아마 css 문제로 안 보이는 게 아닐까요?

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

소소한여자

</strong> <label for="wr_content"> <span class="sound_only">라디오박스</span></label></p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="6"<?php echo ($wr_content == "6") ? " checked" : "";?> required> 순서</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="1"<?php echo ($wr_content == "1") ? " checked" : "";?> required> 1</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="2"<?php echo ($wr_content == "2") ? " checked" : "";?> required> 2</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="3"<?php echo ($wr_content == "3") ? " checked" : "";?> required> 3</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="4"<?php echo ($wr_content == "4") ? " checked" : "";?> required> 4</p>

<p>            <input type="radio" id="wr_content" name="wr_content" value="5"<?php echo ($wr_content == "5") ? " checked" : "";?> required> 5</p>

<p> </p>

<p><strong>
 

 

이렇게 도 해봤는데요 

첫번째 라디오 버튼은 입력값이 나오질 않습니다. 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

엑스엠엘
4년 전
DB에도 저장이 안 되었는지 확인해 보세요.

댓글을 작성하려면 로그인이 필요합니다.

view_comment.skin.php 전체를 올려 보세요.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

소소한여자
4년 전
그누보드 최신 게시판 스킨  basic파일에서 

 [code]

 <?php if ($comment_min || $comment_max) { ?><strong id="char_cnt"><span id="char_count"></span>글자</strong><?php } ?>

        <textarea id="wr_content" name="wr_content" required title="댓글 내용"

        <?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?> placeholder="댓글내용을 입력해주세요"><?php echo $c_wr_content; ?></textarea>

        <?php if ($comment_min || $comment_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>

[/code] 



이부분을 아래 라디오버튼으로 변경하고, 

[code] 



     <label for="wr_content"> <span class="sound_only">지역구</span></label>

            <input type="radio" id="wr_content" name="wr_content" value="1"<?php echo ($c_wr_content == "1") ? " checked" : "";?> required> 1

            <input type="radio" id="wr_content" name="wr_content" value="2"<?php echo ($c_wr_content == "2") ? " checked" : "";?> required> 2

            <input type="radio" id="wr_content" name="wr_content" value="3"<?php echo ($c_wr_content == "3") ? " checked" : "";?> required> 3

            <input type="radio" id="wr_content" name="wr_content" value="4"<?php echo ($c_wr_content == "4") ? " checked" : "";?> required> 4

            <input type="radio" id="wr_content" name="wr_content" value="5"<?php echo ($c_wr_content == "5") ? " checked" : "";?> required> 5


[/code] 





하단 스크립트에서  아래 코드 삭제 

[code] 

  if (char_min > 0 || char_max > 0)

        {

            check_byte('wr_content', 'char_count');

            var cnt = parseInt(document.getElementById('char_count').innerHTML);

            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;

            }

        }

        else if (!document.getElementById('wr_content').value)

        {

            alert("댓글을 입력하여 주십시오.");

            return false;

        }

[/code] 

이것말고는 아무것도 손댄게 없습니다

1번 라디오 버튼의 입력값 1만 입력이 나오질 않습니다 .
1로도 해보고 글자도 넣어보고 했는데 첫번째꺼만 댓글 입력하면 공백입니다. ㅜㅜ

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인