cheditor를 사용한 textarea에 동적 텍스트 할당 방법 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

cheditor를 사용한 textarea에 동적 텍스트 할당 방법 정보

cheditor를 사용한 textarea에 동적 텍스트 할당 방법

본문

cheditor을 사용하는 textarea에 동적으로 텍스트를 넣고 싶습니다.
$('#tx_wr_content' ).val(inputPrn)이런 형식으로 넣었는데 브라우저상 내용이 보이지 않습니다.
위와 같이 할당하고 $('textarea').val()로 확인해 보면 내용이 들어가 있습니다.

id로는 tx_wr_content, message(cheditor용) 둘다 해봤는데, 안되네요..

방법 아시는 분 답변 부탁드립니다

댓글 전체

자답 입니다.
예전에 이런 부분에 대한 질문과 답변이 올라온적 있었네요..
http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=153786
이것 말고 불당님?인가 올리신 내용 있는데 동적으로 입력하는게 아닌 것으로 $content 변수에 직접 입력하는 방식도 있었습니다.(링크를 잊어버려서 링크 못해드립니다.)

그누에 포함된 cheditor의 버전에 따라 또한 현재 정식 버전에 따라 스크립트의 함수, 개체 등등이 호환이 안됩니다.

일단 그누 안에서 dhtml를 사용시 상단에 var ed_wr_content = new cheditor('ed_wr_content');라고
선언됩니다.
따라서 동적으로 선언될 스크립트 부분에 ed_wr_content.insertContents(동적 텍스트 변수명);로 입력해 주시고, cheditor.js의 prototype안 적당 위치에 함수 추가해 줍니다.
appendContents : function (contents) {
this.editArea.focus();
contents = this.editArea.document.body.innerHTML + contents;
this.loadContents(contents);
this.editArea.focus();
},
insertContents : function (contents) {
this.editArea.focus();
this.setSelection();
this.doCmdPaste(contents);
},
(4.32.03버전 기준)

추가용 함수인 appendContents는 중간에 개체 없다고 나옵니다. 아마도 해당 스크립트가 다른 버전의 cheditor 스크립트 인 것 같습니다.

insertContents은 잘 작동 합니다.

관련 내용들 링크 입니다. 최근 버전이신 분들은 참조하셔서 수정하시면 될 듯 합니다.
http://www.chcode.com/cgi-bin/forum/showthreaded.pl?Cat=&Board=cheditor_install&Number=2201&Search=true&Forum=cheditor_install&Words=this.editArea&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=allposts&Main=2201

http://www.chcode.com/cgi-bin/forum/showthreaded.pl?Cat=&Board=cheditor_install&Number=3360&page=&view=&sb=&vc=1#Post3360

개발사 포럼에서 appendContents 등으로 입력하면 해당 글들 나오니 참고하시면 됩니다.
전체 66,558 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT