Sunday, October 27, 2013

[Rails] run simple method from Helper on button click

Greetings,
I'm new to rails and currently having couple problems about how to add
javascript functionality into rails.

I have a simple method in the helper and i want to run this code on
button click.

------------------------------------------------------------------
module PagesHelper
def show_message
"simple output"
end
end

------------------------------------------------------------------

this doesnt work
<%= button_to_function "Print", "show_message()" %>

this doesnt work too
<input onclick=" show_message() " type="button" value="PRINT" />

Can someone please show to properly solve this problem? I would really
apreciate it! thank you!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d37ed6e00e3e054c75147df57dabfed6%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate