Hi I managed to get an ajax form working somewhat, something like the
one below to be able to set and release a bookmark to a post. What I
want to know is how can I change the submit button so that it toggles
between the label, "Pin" and "Un-Pin" ?

<%= form_tag( snipmark_path(@post), :remote => true ) do %>
<%= submit_tag "Pin" %>
<% end %>

Right now the controller code get calls to set or release the bookmark
to the post, but I am getting a error saying Rails can't find my view?
I don't want to change the view. So along with change the submit
button label, what do I need to do to make Rails happy about not find
a view template?


Thanks,
--
Kind Regards,
Rajinder Yadav

--
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.

Search Discussions

  • Dev Guy at Feb 26, 2012 at 9:52 pm

    On Sun, Feb 26, 2012 at 2:02 PM, Dev Guy wrote:
    Hi I managed to get an ajax form working somewhat, something like the
    one below to be able to set and release a bookmark to a post. What I
    want to know is how can I change the submit button so that it toggles
    between the label, "Pin" and "Un-Pin" ?

    <%= form_tag( snipmark_path(@post), :remote => true ) do %>
    <%= submit_tag "Pin" %>
    <% end %>

    Right now the controller code get calls to set or release the bookmark
    to the post, but I am getting a error saying Rails can't find my view?
    I don't want to change the view. So along with change the submit
    button label, what do I need to do to make Rails happy about not find
    a view template?
    ok I managed to figure out I can use link_to with :remote => true and
    then use jQuery to toggle the anchor text

    --
    Kind Regards,
    Rajinder Yadav

    SafetyNet Test Driven Development
    http://safetynet.devmentor.org

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 26, '12 at 7:03p
activeFeb 26, '12 at 9:52p
posts2
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Dev Guy: 2 posts

People

Translate

site design / logo © 2021 Grokbase