I''ve looked at the API, and the only ''button''
reference I found was for
submit. How would I add another button to a form? I tried:
button_tag ''Do Something'', :action =>
''do_something''
But that gave me an error.
Any help would be appreciated.
--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
--- E.Taft Benson
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
As far as I know, the form can only submit to one place, but you can
put logic in the action it submits to that determines which button was
clicked. I have a form that does this and the logic basically goes like
this...
case params["commit"]
when "Do This"
some code to do something
when "Do That"
some code to do something else
end
The "commit" might be able to change to :commit. (Can''t
remember.) The
"Do This" and "Do That" are the values of the submit
buttons.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
It''s simply input :type => ''button'' John W Higgins wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On 9/17/06, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''ve looked at the API, and the only ''button'' reference I found was for > submit. How would I add another button to a form? I tried: > > button_tag ''Do Something'', :action => ''do_something'' > > But that gave me an error. > > Any help would be appreciated. > > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
John,
It sounds so simple, yet I can''t seem to get it right. When I enter
this
line into my view:
<%= input :type => ''button'' %>
I get this error:
wrong number of arguments (1 for 2)
So, I changed it to :
<%= input ''Do Something'', :type =>
''button'' %>
which returns a different error:
`@Do Something'' is not allowed as an instance variable name
What am I missing, here.
-Larry
On 9/17/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> It''s simply input :type => ''button''
>
> John W Higgins
> wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>
>
> On 9/17/06, Larry Kelly <
ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > I''ve looked at the API, and the only
''button'' reference I found was for
> > submit. How would I add another button to a form? I tried:
> >
> > button_tag ''Do Something'', :action =>
''do_something''
> >
> > But that gave me an error.
> >
> > Any help would be appreciated.
> >
> > --
> > Best Regards,
> > -Larry
> > "Work, work, work...there is no satisfactory alternative."
> > --- E.Taft Benson
> >
>
>
> >
>
--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
--- E.Taft Benson
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
api.rubyonrails.com has an entry for the input tag. On 9/19/06, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> John, > It sounds so simple, yet I can''t seem to get it right. When I enter this > line into my view: > > <%= input :type => ''button'' %> > > I get this error: > wrong number of arguments (1 for 2) > > > > So, I changed it to : > > <%= input ''Do Something'', :type => ''button'' %> > > which returns a different error: > > `@Do Something'' is not allowed as an instance variable name > > > What am I missing, here. > -Larry > > > On 9/17/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > It''s simply input :type => ''button'' > > > > John W Higgins > > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > > > > > On 9/17/06, Larry Kelly < ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I''ve looked at the API, and the only ''button'' reference I found was for > submit. How would I add another button to a form? I tried: > > > > > > button_tag ''Do Something'', :action => ''do_something'' > > > > > > But that gave me an error. > > > > > > Any help would be appreciated. > > > > > > -- > > > Best Regards, > > > -Larry > > > "Work, work, work...there is no satisfactory alternative." > > > --- E.Taft Benson > > > > > > > > > > > > > > > > > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson > > >-- More software projects have gone awry for lack of calendar time than for all other causes combined. -- Fred Brooks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Michael Campbell wrote:> api.rubyonrails.com has an entry for the input tag. > > > On 9/19/06, Larry Kelly <ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > John, > > It sounds so simple, yet I can''t seem to get it right. When I enter this > > line into my view: > > > > <%= input :type => ''button'' %> > > > > I get this error: > > wrong number of arguments (1 for 2) > > > > > > > > So, I changed it to : > > > > <%= input ''Do Something'', :type => ''button'' %> > > > > which returns a different error: > > > > `@Do Something'' is not allowed as an instance variable name > > > > > > What am I missing, here. > > -Larry > > > > > > On 9/17/06, John Higgins <wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > It''s simply input :type => ''button'' > > > > > > John W Higgins > > > wishdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > > > > > > > > > On 9/17/06, Larry Kelly < ldk2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > I''ve looked at the API, and the only ''button'' reference I found was for > > submit. How would I add another button to a form? I tried: > > > > > > > > button_tag ''Do Something'', :action => ''do_something'' > > > > > > > > But that gave me an error. > > > > > > > > Any help would be appreciated. > > > > > > > > -- > > > > Best Regards, > > > > -Larry > > > > "Work, work, work...there is no satisfactory alternative." > > > > --- E.Taft Benson > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > Best Regards, > > -Larry > > "Work, work, work...there is no satisfactory alternative." > > --- E.Taft Benson > > > > > > > > -- > More software projects have gone awry for lack of calendar time than > for all other causes combined. -- Fred BrooksA neat trick for this that I picked up somewhere... give your custom button a :name attribute. <%= submit ''cancel'', :name=>:cancel %> Then on submission, look for params[:cancel]. If it''s there, that button was pressed. _Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Try this: <%= submit_tag "Name", :type => ''button'' %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---