You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ximego <Gu...@fao.org> on 2007/09/12 17:42:08 UTC

TinyMCE Editor with AJAX

I use a textarea on my page, and it works well with ajax to get the value of
textarea. please see my code:

   textareaComp.add(new AjaxFormComponentUpdatingBehavior("onchange"){
                    protected void onUpdate(AjaxRequestTarget target) {
                        .....
                   }
                }
                );

But when I use TinyMCE instead of textarea, the above code doesn't
work....Any hint? Thanks in advance.
-- 
View this message in context: http://www.nabble.com/TinyMCE-Editor-with-AJAX-tf4430222.html#a12638380
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: TinyMCE Editor with AJAX

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
It looks like as if the 'blur' event never is called.
When changed to 'keyup' the event handler is called.

Further RichTextField_instance doesn't seem to have a 'formElement' anymore.
Therefore according to the TinyMCE APIs the underlying textarea can be
retrieved via RichTextField_instance.getElement().
But the textarea has no method called 'onchange'.

Anyone knows how to manually trigger the onchange event of the textarea?


Regards,
Manfred

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/TinyMCE-Editor-with-AJAX-tp1848394p2279678.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: TinyMCE Editor with AJAX

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
Hello.

I have tried your suggestion but it doesn't seem to solve the issue.
I use a OnChangeAjaxBehavior instead of a AjaxFormComponentUpdatingBehavior
as the OP.

Any other ideas how to get Ajax onchange events back?


Regards,
Manfred
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/TinyMCE-Editor-with-AJAX-tp1848394p2279368.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: TinyMCE Editor with AJAX

Posted by Carlos Pita <ca...@gmail.com>.
Try something like this to call onchange on the textarea:

function RichTextField_newInstance(instance){
     RichTextField_instance = instance;
}

function RichTextField_onEvent(e){
	if (e.type == 'blur') {
	    var value = RichTextField_instance.getBody().innerHTML;
	    var textArea = RichTextField_instance.formElement;
	    if (textArea.value != value) {
                textArea.value = value;
	        textArea.onchange();
	    }
	}
	return true;
}

tinyMCE.init({
        ...
        init_instance_callback : "RichTextField_newInstance",
	handle_event_callback : "RichTextField_onEvent",
        ...
});

Regards,
Carlos

On 9/12/07, ximego <Gu...@fao.org> wrote:
>
> I use a textarea on my page, and it works well with ajax to get the value of
> textarea. please see my code:
>
>    textareaComp.add(new AjaxFormComponentUpdatingBehavior("onchange"){
>                     protected void onUpdate(AjaxRequestTarget target) {
>                         .....
>                    }
>                 }
>                 );
>
> But when I use TinyMCE instead of textarea, the above code doesn't
> work....Any hint? Thanks in advance.
> --
> View this message in context: http://www.nabble.com/TinyMCE-Editor-with-AJAX-tf4430222.html#a12638380
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org