Hi Francisco


francisco treacy wrote:
i have created a basic wicket component that integrates MooEditable, a
lightweight textarea editor based on mootools.

http://code.google.com/p/wicket-mooeditable/

usage (in your form):

                TextArea<String> textarea = new TextArea("post");
                textarea.setOutputMarkupId(true);
                textarea.add(new MooEditableBehavior());
                form.add(textarea);

                (...)

                form.add(new MooEditableAjaxButton("submit", form) {
                        
                        @Override
                        protected void onSubmit(AjaxRequestTarget arg0, Form 
arg1) {
                                // stuff here
                        }
                
                });


the need for a special button is because the updated contents of the
textareas have to be saved before submit. MooEditableAjaxButton is an
AjaxFallbackButton that decorates the submit's onclick, calling
saveContent() on every mooeditable-enabled textarea.

<input id="submit4" name=":submit" onclick="post1.saveContent();
title2.saveContent(); var wcall=wicketSubmitFormById('form3' (...)) ;
return false;" type="submit" value="ok" wicket:id="submit"/>

the problem here is that it will always fall back to a normal post,
never an ajax one. if i change my button to
form.add(new AjaxFallbackButton("submit", form) { ... }  ajax submit
does work fine.
but obviously the model binding is not good (post1.saveContent();
title2.saveContent(); is not added, therefore textarea's contents are
not updated).
Looks like it's a mootools thing? You could take a look at YUI editor or tinyMCE and see how they do their form submission...
my knowledge in javascript is really limited. how can i get to post
updated contents with pure ajax, not degrading to a normal request?

thanks,

francisco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to