SolutionCottage.com
Posted  10 Jul 2009 - 08:21:24

Category: Ruby on Rails


Rails, create button without submit behaviour

Issue:
You want to create a button in Rails that is equal to:

<input type="button"/>

You can also include javascript on this button, and it will not submit a form.

Solution:

<%= submit_tag "Test me!", :type => 'button', :onclick => 'alert("It works!")' %>



Marked as helpful by 78 users




4 comments:

3/28/2013 7:01:54 AM  Manoj  wrote:

Thank U


2/2/2012 11:37:03 AM  jayaprakash  wrote:

how to link the one page to another page using button in rails "ple send me jayaprakash@srishtisoft.com


1/20/2012 9:26:42 AM  Jagannathan Sundaram  wrote:

Thanks a lot for your solution. you save my time


9/15/2011 12:05:29 PM  taimoor changaiz  wrote:

A good effort this kind of sites should be made. I appreciate this kind of things should be available to help developers. Thanks, Taimoor Changaiz









© SolutionCottage 2008-2011 7/25/2017 7:30:16 AM