lse123 Posted July 27, 2010 Author Share Posted July 27, 2010 var html = myEditor.get('element').value; // you mean exactly below this line the---document.getElementById("hidden_id").value = html; Link to comment Share on other sites More sharing options...
ShadowMage Posted July 28, 2010 Share Posted July 28, 2010 var html = myEditor.get('element').value; // you mean exactly below this line the---document.getElementById("hidden_id").value = html; Assuming you also have a hidden input:<input type="hidden" id="hidden_id" name="hidden_name">somewhere inside your form, yes that will work. Link to comment Share on other sites More sharing options...
lse123 Posted July 28, 2010 Author Share Posted July 28, 2010 Assuming you also have a hidden input:<input type="hidden" id="hidden_id" name="hidden_name">somewhere inside your form, yes that will work.what if contents of hidden field(html js var) is html & text, does it matters? Link to comment Share on other sites More sharing options...
ShadowMage Posted July 28, 2010 Share Posted July 28, 2010 what if contents of hidden field(html js var) is html & text, does it matters?Probably not, but I guess it depends on what you mean by "text"You might want to escape your HTML before you place it in your hidden input, though. In your code, just before this line:document.getElementById("hidden_id").value = html;put this line:html = html.replace("<", "<"); Link to comment Share on other sites More sharing options...
lse123 Posted August 6, 2010 Author Share Posted August 6, 2010 http://developer.yahoo.com/yui/editor/#getdatathe below at above instructions^,....must be inserted plain or in submitForm() --> onsubmit="return submitForm();" ?what are the:'somebutton', 'element'...?var myEditor = new YAHOO.widget.Editor('msgpost');myEditor.render();//Inside an event handler after the Editor is renderedYAHOO.util.Event.on('somebutton', 'click', function() { //Put the HTML back into the text area myEditor.saveHTML(); //The var html will now have the contents of the textarea var html = myEditor.get('element').value;}); where insert the below...> inside event function or ?html = "<i>hjgjhgjhgbjhgjh nkjnkjnkj</i>"; // for testinghtml = html.replace("<", "<");document.getElementById("hiddenField").value = html; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.