Forum: Ruby Clilking on a link should replace that link with a form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2063ef884e754d2667955c93da781833?d=identicon&s=25 Andrew (Guest)
on 2009-02-18 22:40
(Received via mailing list)
Hi everyone!

I'm new to Ruby and JS, and there is a problem I'm trying to solve:
I need a link that, when clicked, transforms into a form for inputting
data. I have next code:

(show.html.erb)
<div id="new_journal">
    <%= link_to_remote 'New Journal',
      :url => { :action => :expand_create_form, :controller
=> :journals, :user_id => @user.id } %>
</div>

(expand_create_form.js.rjs)
page[:new_journal].replace_html :partial => "create",
  :object => @user


The problem is I don't want to use the controller, is there some
shortcut to call rjs code when user clicks on "New Journal" link?
1bc63d01bd3fcccc36fb030a62039352?d=identicon&s=25 David Masover (Guest)
on 2009-02-18 22:56
(Received via mailing list)
Andrew wrote:
> Hi everyone!
>
> I'm new to Ruby and JS, and there is a problem I'm trying to solve:
> I need a link that, when clicked, transforms into a form for inputting
> data.

Ruby doesn't really have anything to do with links, or with JavaScript.

I think you might want to ask this question on the Rails list.
2063ef884e754d2667955c93da781833?d=identicon&s=25 Andrew (Guest)
on 2009-02-18 23:36
(Received via mailing list)
On Feb 18, 11:55 pm, David Masover <ni...@slaphack.com> wrote:
> Andrew wrote:
> > Hi everyone!
>
> > I'm new to Ruby and JS, and there is a problem I'm trying to solve:
> > I need a link that, when clicked, transforms into a form for inputting
> > data.
>
> Ruby doesn't really have anything to do with links, or with JavaScript.
>
> I think you might want to ask this question on the Rails list.

Oh, yes, you're right.
This topic is locked and can not be replied to.