specifying html class to submit_to_remote

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

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/

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

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.

Hi   Thanks for your replies.Its output is a little bit length.I am sending this..For submit_to_remote

<input class="itilbuttonlink1" name="search_btn" onclick="new Ajax.Request('/service_desk/search_knowledge_base/9', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)}); return false;" value="Search" type="button">

And for link_to_remote (here class is working)

<a class="itilbuttonlink1" href="#" onclick="new Ajax.Updater('search_knowledgebase_div', '/service_desk/kb_result_cancel_button/9', {asynchronous:true, evalScripts:true}); return false;">Cancel</a>

Sijo

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

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.

<div class="whatever"> <%= link_to_remote... %> ...and so on </div>

F

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

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