mindmup / bootstrap-wysiwyg

Tiny bootstrap-compatible WISWYG rich text editor
MIT License
5.56k stars 844 forks source link

Unable to post content in php yii framework #131

Open salini11 opened 10 years ago

salini11 commented 10 years ago

hai, I am new to yii and wysiwyg text editor. Since the textarea is defined within a div, the data inserted in the editor is not passing to anothe page (POST method is not working) Please somebody help me. May be my problem is stupid one but please somebody help me to solve this

prakash2089 commented 10 years ago

I think that, you have described like this in html, // div class="wysiwyg-editor" id="editor_content" And in your javascript, // Necessary javascript function for wysiwyg editor // $('#editor_content').wysiwyg({ });

Then you can use "id" of the form and "hidden id" for editor content(which contains editor content) to post method, by using ajax like this,

$('#save-form').submit(function () { $('#hdn-editor_content').val($('#editor_content').html()); var saveForm = this; $.ajax({ url: this.action, type: this.method, data: $(this).serialize(), success: function (result) { if (result.status == true) { saveForm .reset(); alert("Saved successfully"); } } }); return false; });

salini11 commented 10 years ago

Thank you prakash I have tried some thing like to retrieve the content from the div the same you were told but not used ajax. I used only JavaScript. this worked properly

prakash2089 commented 10 years ago

You can't use HTML tags here, that's why I didn't see your code. Anyway, Good job !