0

Trying to accomplish a simple test for a project I'm working on.

The Form

<form id="agreement_text_form" action="" method="POST" onsubmit="updateAgreementText(); return false">
   <textarea name="agreement_text" id="agreement_text"></textarea>
   <input type="submit" value="Update Agreement Text" />
</form>

The textarea has a WYSIWYG added to it (not needed but just in case here is that function

var hb_silk_icon_set_blue = $("#agreement_text").css("height","240").css("width","695").htmlbox({
			        toolbars:[
			             ["bold","italic","underline","strike","undo","redo","separator_dots","left","center","right","justify"]
			        ],
			        icons:"silk",
			        skin:"blue"
			    });
			    </script>

I was able to get a border around the text area using this line:

$('#agreement_text_html').css('border','3px solid red');

But still not able to set a value with that selector (I've tried quite a bit as well).

Summarized

<form id="agreement_text_form" action="" method="POST" onsubmit="updateAgreementText(); return false">
   <table id="agreement_text_wrap">
      <tr>
         <td id="agreement_text_container">
            <iframe style="width: 695px; height: 240px;" id="agreement_text_html"></iframe>
            <textarea name="agreement_text" id="agreement_text" style="height: 240px; width: 695px; display: none; "></textarea>
         </td>
      </tr>
   </table>
   <input type="hidden" id="employee_id" name="employee_id" value="1822">
   <input type="hidden" id="action" name="action" value="update_agreement_text">
   <input type="submit" value="Update Agreement Text">
</form>

Thank you for any help, I'm pretty familiar with PHP/JS/JQUERY/AJAX so any help may go a long way, I've already google everything I can think of. Thanks again

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Troy III
0

Problem is I can't access the textarea content. I want to dynamically fill the textarea with html-text from the database (through an ajax call). At the moment without a problem I can fetch the data and put it in a div, put I also want to add the content to the textarea.

Also, I've tested removing the WYSIWYG editor and I can easily $('textarea).val("test text") and get the results I want, but then as soon as I add the editor I get the extra html that makes it nearly impossible for me to insert a val to the text area. Hope this helps to clarify

Edited by Xtremefaith: n/a

0

can you access the "text_area" at all, 'cause I'm almost sure you aren't being able to do so.

so for a start you'll need to reference your textarea by id explicitly, once again and store that reference in a variable with the same name and see what you get:

agreement_text=document.getElementById("agreement_text");

to make sure you are being able to access it at all.

Do a fast alert(agreement_text.tagName) to see if it returns "textarea"
if it does, -try populating it again, say: agreement_text.value="I'm agree complete"
if it doesn't set the arbitrary value given.
Than you'll need to: agreement_text.style.display=""; before you try again.
You can't manipulate an element that has the display att set to "none"!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.