Clilking on a link should replace that link with a form

A

Andrew

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",
:eek:bject => @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?
 
D

David Masover

Andrew said:
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.
 
A

Andrew

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top