Ruby on Rails Saturday, October 2, 2010

I am just learning Ruby.
I created a simple application where an record is added from a "new"
view. Some input fields are defined as a select option (using a
helper). Now I want to add a Javascript function with "onclick"
function. How can I do it?

Helper:

module MypagesHelper
def my_pictures
pictures = [ 'pic1', 'pic2', 'pic3', 'pic4','pic5','pic6' ]
pictures_list = pictures.sort
pictures_list.collect{|l| l}
end
end

View:
<% form_for(@mypage) do |f| %>
<%= f.error_messages %>

<%= f.label :backgroud_picture %><br />
<%= f.select :backgroud_picture, my_pictures %>


Thanks,

Zalek

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment