I have a very simple procedure that I am trying to implement. I have the following code in my controller: <%= text_field(:invoice, :id, :size => 20, :onkeydown => %Q($(''button-id'').action = ''#{url_for(:controller => ''invoice'', :action => ''edit'')}?id='' + $F(''invoice_id'');)) %> <%= button_to (''Goto Invoice #'', {:id => ''invoice_id'', :action => :edit}, {:id => ''button-id''}) %> (Thanks to the help of Francois, btw). I want to simply have the user enter and invoice # and press the button that will then show the selected invoice in with the edit action. However, I need to be able to set the form id that is automatically generated by the button_to method to use the above javascript. Does anyone know how to do this? Or is there an easier way to accomplish my goal here? Thanks, ~damon _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Francois Beausoleil
2005-Dec-07 00:13 UTC
Re: howto set the form_id in the button_to method
Hello Damon, 2005/12/6, Damon Hill <mdamonhill@gmail.com>:> I want to simply have the user enter and invoice # and press the button that > will then show the selected invoice in with the edit action. > However, I need to be able to set the form id that is automatically > generated by the button_to method to use the above javascript.Looking at the button_to macro, there is no way currently to set the form's ID.> Does anyone know how to do this? > Or is there an easier way to accomplish my goal here?Just thought of something - you're not by any chance nesting forms too, right ? That's disallowed. If you are not nesting forms, then the following should work: <%= start_form_tag :controller => 'invoice', :action => 'edit' %> <label>Invoice No: <%= text_field 'invoice', 'id' %></label> <%= submit_tag 'Go' %> <%= end_form_tag %> That should do the trick. DTSTTCPW (Do The Simplest Thing That Could Possibly Work)... Bye ! -- François Beausoleil http://blog.teksol.info/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails