Ok, this is driving me nuts. I''m trying to RJS some text into a
text_area which may or may not have been written in by the user. if I
page.insert_html :before, :after, :top, or :bottom, it either sticks
the contents above or below the text box (but never in). If I do:
page[:textboxid].value = "blah"
it overwrites the contents of the textbox but doesn''t APPEND to it.
I''ve tried doing something to the effect of
page[:textboxid].value = "blah" + page[:textboxid].value
or
page[:textboxid].value = "blah" +
$#{''textboxid''}.value
and several variants. But I keep getting errors. Or... nothing.
Someone please help me before I put my fist through my screen.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thats a good question. I can''t get it to work with RJS, but this simple
prototype based javascript works fine. I guess you could stick it in a
function and call your function from RJS.
$(''tarea'').value = $(''tarea'').getValue() +
" blah"
johnhutch wrote:> Ok, this is driving me nuts. I''m trying to RJS some text into a
> text_area which may or may not have been written in by the user. if I
> page.insert_html :before, :after, :top, or :bottom, it either sticks
> the contents above or below the text box (but never in). If I do:
>
> page[:textboxid].value = "blah"
>
> it overwrites the contents of the textbox but doesn''t APPEND to
it.
> I''ve tried doing something to the effect of
>
> page[:textboxid].value = "blah" + page[:textboxid].value
> or
> page[:textboxid].value = "blah" +
$#{''textboxid''}.value
>
> and several variants. But I keep getting errors. Or... nothing.
> Someone please help me before I put my fist through my screen.
>
>
> >
>
--
Sincerely,
William Pratt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
YAYYYY IT WORKED! Here''s my RJS/javascript code:
<%= link_to_function "Append to Text Area" do |page|
page << "$(''textarea_id'').value =
$(''textarea_id).getValue() +
''blah!''"
end
%>
On Oct 25, 9:39 pm, William Pratt
<bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org>
wrote:> Thats a good question. I can''t get it to work with RJS, but this
simple
> prototype based javascript works fine. I guess you could stick it in a
> function and call your function from RJS.
>
> $(''tarea'').value =
$(''tarea'').getValue() + " blah"
>
>
>
> johnhutch wrote:
> > Ok, this is driving me nuts. I''m trying to RJS some text into
a
> > text_area which may or may not have been written in by the user. if I
> > page.insert_html :before, :after, :top, or :bottom, it either sticks
> > the contents above or below the text box (but never in). If I do:
>
> > page[:textboxid].value = "blah"
>
> > it overwrites the contents of the textbox but doesn''t APPEND
to it.
> > I''ve tried doing something to the effect of
>
> > page[:textboxid].value = "blah" + page[:textboxid].value
> > or
> > page[:textboxid].value = "blah" +
$#{''textboxid''}.value
>
> > and several variants. But I keep getting errors. Or... nothing.
> > Someone please help me before I put my fist through my screen.
>
> --
> Sincerely,
>
> William Pratt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---