Cannot get the text area contents onclick

30 views
Skip to first unread message

Gyani

unread,
Sep 3, 2009, 6:58:23 AM9/3/09
to MooEditable
Hi,

I am referring to one of the examples you have given, where on
clicking on the submit button "alert($('textarea-1').value);" returns
the formatted text in the textarea.

We are not using the Submit button (input type=submit), but we are
using "A HREF ONCLICK" route. On clicking, we are executing
"form.submit();" which submits the form.

When we take this route, AND DO NOT FORMAT THE TEXT, the servlet does
not get the typed content. "alert($('textarea-1').value)" returns
BLANK!

"alert($('textarea-1').value)" returns correct text, only when
a) When we format the text
a) We need to forcefully hit the carriage return (ENTER) to get the
actual value.

When we do not format the text OR hit the enter key, we receive
blank!

Regards,
Gyani

tru10000

unread,
Sep 3, 2009, 1:25:48 PM9/3/09
to MooEditable
It seems that when mooeditable starts up it grabs the textarea element
out of the form element. So when you submit the form, it no longer
contains the textarea. So to get it to work, I had to make the form
grab the textarea back upon submit. Or you could inject the textarea
back into the form and then submit.

Gyanesh M Khanolkar

unread,
Sep 3, 2009, 1:33:55 PM9/3/09
to mooed...@googlegroups.com
Thanks for your reply.

Would you then advice that I call "saveContent();" in the function "editorKeyPress", so that the contents get saved in the text area as we type the content?

tru10000

unread,
Sep 3, 2009, 1:41:34 PM9/3/09
to MooEditable
Here's the code I used:

editor.saveContent();
form.grab(textarea);
textarea.inject(form);
form.submit();

You can just call saveContent() once before submitting. Also, I'm not
sure why I had the form grab the textarea AND inject it back into the
form before submitting. But it works.

On Sep 3, 7:33 am, Gyanesh M Khanolkar <gyanesh...@gmail.com> wrote:
> Thanks for your reply.
>
> Would you then advice that I call "saveContent();" in the function
> "editorKeyPress", so that the contents get saved in the text area as we type
> the content?
>

Pawel Krefta

unread,
Oct 20, 2009, 11:08:06 AM10/20/09
to MooEditable
I'm suggesting shorter version

$('your_textarea_id').retrieve('MooEditable').getContent();

This also works.

LePad

unread,
Nov 7, 2009, 3:35:14 AM11/7/09
to MooEditable
This shorter version didn't exactly work, had to replace the
"MooEditable" by "MooEditable-textarea". Otherwise it's alright :)
Do you think this bug possibly be fixed in a next release ? It's quite
annoying...

On 21 oct, 02:08, Pawel Krefta <pawel.kre...@gmail.com> wrote:
> I'm suggesting shorter version
>
> $('your_textarea_id').retrieve('MooEditable').getContent();
>
> This also works.
>
> On Sep 3, 7:41 pm, tru10000 <worshipf...@gmail.com> wrote:
>
> > Here's the code I used:
>
> > editor.saveContent();
> >form.grab(textarea);
> > textarea.inject(form);
> >form.submit();
>
> > You can just call saveContent() once before submitting. Also, I'm not
> > sure why I had theformgrab the textarea AND inject it back into the
> >formbefore submitting. But it works.
>
> > On Sep 3, 7:33 am, Gyanesh M Khanolkar <gyanesh...@gmail.com> wrote:
>
> > > Thanks for your reply.
>
> > > Would you then advice that I call "saveContent();" in the function
> > > "editorKeyPress", so that the contents get saved in the text area as we type
> > > the content?
>
> > > On Thu, Sep 3, 2009 at 10:55 PM, tru10000 <worshipf...@gmail.com> wrote:
>
> > > > It seems that when mooeditable starts up it grabs the textarea element
> > > > out of theformelement. So when yousubmittheform, it no longer
> > > > contains the textarea. So to get it to work, I had to make theform
> > > > grab the textarea back uponsubmit. Or you could inject the textarea
> > > > back into theformand thensubmit.
>
> > > > On Sep 3, 12:58 am, Gyani <gyanesh...@gmail.com> wrote:
> > > > > Hi,
>
> > > > > I am referring to one of the examples you have given, where on
> > > > > clicking on thesubmitbutton "alert($('textarea-1').value);" returns
> > > > > the formatted text in the textarea.
>
> > > > > We are not using theSubmitbutton (input type=submit), but we are

LePad

unread,
Nov 7, 2009, 3:43:34 AM11/7/09
to MooEditable
Well actually, didn't work either... That worked once, I have no idea
why... and no idea how to make it work !!
Didn't understand the grab and inject method given before.... Could
anybody try to explain me please ?
Reply all
Reply to author
Forward
0 new messages