Posted By

newtonapple on 08/20/06


Tagged

ruby rubyonrails erb rhtml


Versions (?)

Who likes this?

11 people have marked this snippet as a favorite

xurde
ryanprel
bbebop
bluefuton
chrisaiv
vali29
webstic
tobsenll
davidsi
painteddigital
lookingforsome


Ruby On Rails Form Helper with Image Submit Button


 / Published in: Ruby
 

  1. # this code is for embedded ruby in rhtml:
  2.  
  3. <%= button_to 'Add to Cart', :action => :add_to_cart, :id => product %>
  4. # this generates a submit button:
  5. # <form method="post" action="/store/add_to_cart/3" class="button-to">
  6. # <div><input type="submit" value="Add to Cart" /></div></form>
  7. # note id = 3 in this case
  8.  
  9. # the following has the same effect as above but w/ image submit button:
  10. <%= form_tag :action => :add_to_cart, :id => product %>
  11. <%= image_submit_tag product.image_url, :class => 'image-submit' %>
  12. <%= end_form_tag %>
  13. # <form action="/store/add_to_cart/3" method="post">
  14. # <input class="image-submit" src="/images/auto.jpg?1156046942" type="image" />
  15. # </form>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: vinumams on July 14, 2010

Can any one help me out for the below mentioned problem.

I need to build a script using RUBY. I am very newer to this tool. I need to click on image button which doesn't have any ID or unique name. it contains only 'href' option. i tried,
ie.button(:src, "/Zoom_add.gif/").click but its not working. pls help me out.

You need to login to post a comment.