Toggling a ajax form button

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

On Sun, Feb 26, 2012 at 2:02 PM, Dev G. [email protected] wrote:

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs