# Button function in rails

**URL:** <https://www.ruby-forum.com/t/button-function-in-rails/193750>\
**Category:** Rails\
**Created:** [August 23, 2010, 10:16pm UTC](https://www.ruby-forum.com/t/button-function-in-rails/193750 "2010-08-23T22:16:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ithelp85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/87869e/32.png) [@ithelp85](https://www.ruby-forum.com/u/ithelp85)\
**Post date:** [August 23, 2010, 10:16pm UTC](https://www.ruby-forum.com/t/button-function-in-rails/193750/1 "2010-08-23T22:16:18Z")

</div>

I want to create a button function on a main page that updates the  
database, without having to open the form and editing and updating  
through the form.

Anyone know how to do this, if it is possible?

Thanks in advance for any help you can provide.

---

<div class="post-metadata">

**Author:** ![ithelp85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/87869e/32.png) [@ithelp85](https://www.ruby-forum.com/u/ithelp85)\
**Post date:** [August 23, 2010, 10:23pm UTC](https://www.ruby-forum.com/t/button-function-in-rails/193750/2 "2010-08-23T22:23:51Z")

</div>

On 23 August 2010 21:16, Ithelp Eighty-five [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I want to create a button function on a main page that updates the  
> database, without having to open the form and editing and updating  
> through the form.

Do you mean you want just a button to appear, which when pressed posts  
some data to the edit method in the controller?

If so just provide an empty form with a submit button which posts to  
the appropriate action, putting the data you want submitted in hidden  
fields in the form. Then all the user will see is the button.

Colin
