# Specifying html class to submit\_to\_remote

**URL:** <https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394>\
**Category:** Rails\
**Created:** [March 31, 2008, 8:04am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394 "2008-03-31T08:04:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 8:04am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/1 "2008-03-31T08:04:14Z")

</div>

Hi  
I am using submit\_to\_remote as below.But the class not working as  
expected.Please help to correct it

\<%= submit\_to\_remote ‘search\_btn’, ‘Search’,  
:html =\> {:class =\> ‘itilbuttonlink1’},  
:url =\> { :controller =\> ‘service\_desk’, :action  
=\> ‘search\_knowledge\_base’, :id =\> @sd\_ticket } %\>

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 8:14am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/2 "2008-03-31T08:14:03Z")

</div>

How is it working, and how do you expect it to work?

Julian.

Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME)  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 8:30am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/3 "2008-03-31T08:30:27Z")

</div>

Hi  
I have another cancel button just below the above submit\_to\_remote  
.It has also the same html class applied  
\<%= link\_to\_remote( “Cancel”,  
{:update =\> “search\_kb\_div”,  
:url =\> {:controller =\> ‘service\_desk’, :action =\>  
‘kb\_result\_cancel\_button’, :id =\> @params[:id]}},  
{:class =\> ‘itilbuttonlink1’}) %\>

But it is working properly.Normally a white background and when pointing  
out a grey one.Is my way of specifying class to submit\_to\_remote not  
right?

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 9:48am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/4 "2008-03-31T09:48:42Z")

</div>

It should work. Please check the output html source to see if the  
generated input tag has the class attribute. If so, there might be  
some issue with your CSS style.

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 10:39am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/5 "2008-03-31T10:39:39Z")

</div>

Hi  
Thanks for your replies.Its output is a little bit length.I am sending  
this…For submit\_to\_remote

And for link\_to\_remote (here class is working)

Cancel

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 11:02am UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/6 "2008-03-31T11:02:10Z")

</div>

On 31 Mar 2008, at 09:39, Sijo Kg wrote:

> Hi  
> Thanks for your replies.Its output is a little bit length.I am sending  
> this…For submit\_to\_remote

Well as you can see it is setting the class properly so something’s  
wrong with your css.

Fred

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/7 "2008-03-31T20:55:53Z")

</div>

submit\_to\_remote only has 3 arguments:  
submit\_to\_remote(name, value, options = {})

Your code has 4 arguments for submit\_to\_remote.

link\_to\_remote is different.

This works for me (Rails 2.0.2) :

\<%= submit\_to\_remote ‘general’, ‘Preview’,  
{ :url =\> {:action =\> ‘general\_preview’},  
:html =\> {:class =\> ‘submitbutton’}}  
%\>

Note that there is one options hash with several sub-hashes, 3  
arguments only. My .css file has an entry for ‘.submitbutton’, of  
course.

F

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 2:07pm UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/8 "2008-03-31T14:07:04Z")

</div>

I don’t know what your problem is, but when I have multiple submit  
buttons I do it differently and it works. I put the class on a div  
around the buttons. But it’s not exactly the same thing, of course.

 \<%= link\_to\_remote... %\> ...and so on

F

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [March 31, 2008, 9:25pm UTC](https://www.ruby-forum.com/t/specifying-html-class-to-submit-to-remote/133394/9 "2008-03-31T21:25:27Z")

</div>

submit\_to\_remote only has 3 arguments:  
submit\_to\_remote(name, value, options = {})

Your code has 4 arguments for submit\_to\_remote.

link\_to\_remote is different.

This works for me (Rails 2.0.2) :

\<%= submit\_to\_remote ‘general’, ‘Preview’,  
{ :url =\> {:action =\> ‘general\_preview’},  
:html =\> {:class =\> ‘submitbutton’}}  
%\>

Note that there is one options hash with several sub-hashes, 3  
arguments only. My .css file has an entry for ‘.submitbutton’, of  
course.

F
