开发者

How the jQuery TinyMCE and jQuery RSV get to work?

I'm using RSV to validate form element, and tinymce to convert textarea to editor.

The textarea is included to be checked by rsv validator using 'required', since the textarea is being converted to tinymce editor. Theres a problem on the validation, even i entered the value in the editor the validator says that textarea is a null.

How can i validate the textarea using RSV?

any ideas?

Thanks in开发者_如何学JAVA advance.


I'm not familiar neither with jQuery RSV nor the jQuery TinyMCE plugin and thus don't know how RSV tries to validate this.

But I hope you are at least aware that TinyMCE makes heavy modifications to the actual DOM to do its job. And that the textarea you see and are writing in, has nothing to do with the original <textarea></textarea> you called the plugin on.

That is because the actual editing area is in an dynamically created iframe. Probably that explains why jQuery RSV can't validate the original textarea which probably is hidden and still empty as the real editing area is in an iframe. But..

Assuming you have similar code to this in somewhere in your project

<textarea id="content" name="content" style="width:100%"></textarea>
$('#content').tinymce({
...
})

Hopefully RSV has some callbacks which allow you to do something before the validations is actually done. If that is the case you need to hook into such a callback and make the call

$('#content').html()

Which should (handled by the jQuery TinyMCE plugin) give you the actual content typed in TinyMCE.

Now I suggest that you actually insert two textareas in your form. One hidden which is the one you validate via RSV. Now you only need to place the output of the above call in the hidden textarea and RSV should validate it just fine

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜