[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Clilking on a link should replace that link with a form

Andrew

2/18/2009 9:39:00 PM

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?
2 Answers

David Masover

2/18/2009 9:55:00 PM

0

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.

Andrew

2/18/2009 10:34:00 PM

0

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.