开发者

Text Area Not Updating Correctly

I have a WYSIWYG text area that is located inside of a jquery created tab layer that when you click submit it updates a field in my database, and posts it back to the text area through value.

However, when I try to do this I must click the submit button once then again when the page reloads to have the value update in the text area.

This problem of submitting twice only happens when I add a WYSIWYG editor to the text area, it updates fine when it is not a WYSIWYG editor.

I have tried all of the major WYSIWYG editors out there to see if it was the editor but I am starting to think that having the text 开发者_如何学JAVAarea in a jquery area might be affecting the WYSIWYG editor.

So what do you guys think?


You could simply redirect the page upon submission, to refresh the content on the page. Using a simple header('Location: /page.php?msg=success'); would work well.

This method also follows the Post/Redirect/Get design pattern.

I have just seen from your example you're are posting the form with Ajax with TinyMCE. TinyMCE does not use the textarea, it creates an iframe with the editor in it and passes it to the textarea on submit. In order for these functions to work with jQuery you will need to make sure you're using the TinyMCE jQuery plugin. Additionally to insert data into the editor you will need to use a different method than just .html().

$('#content').tinymce().execCommand('mceInsertContent',false,'<b>Hello world!!</b>');

See the TinyMCE jQuery example page for more details/methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜