I would really like to know how i can submit a form without having to have the standard submit_tag button on my form. i just want to say: link_to "Save", :action (((submit_form))) Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
What''s the motivation behind this? do you just want to have a link to click on instead of a button? I don''t know of any ''HTML built in'' solution for this but here is one that uses javascript http://www.thesitewizard.com/archive/textsubmit.shtml In general using a link to sumbit a form (using GET instead of a POST) is a dangerous thing to do, especially if this form will change contents in your database. this is due to web crawlers that may crawl your website and click on links - and therefore your db contents may change behind the scenes. using POST is always the better way. but I may have misunderstood your intention. anyway, HTH. -- 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 -~----------~----~----~----~------~----~------~--~---
<%= link_to_remote ''Submit'', { :url => { :action =>
''create'' }, :with => "
Form.serialize($(''form_id''))" }, { :class =>
"style_class" } -%>
Vish
On 11/4/06, Alon
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> What''s the motivation behind this? do you just want to have a link
to
> click on instead of a button?
>
> I don''t know of any ''HTML built in'' solution for
this but here is one
> that uses javascript
>
> http://www.thesitewizard.com/archive/textsubmit.shtml
>
> In general using a link to sumbit a form (using GET instead of a POST)
> is a dangerous thing to do, especially if this form will change contents
> in your database. this is due to web crawlers that may crawl your
> website and click on links - and therefore your db contents may change
> behind the scenes. using POST is always the better way.
>
> but I may have misunderstood your intention.
>
> anyway, HTH.
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---
Alon wrote:> What''s the motivation behind this? do you just want to have a link to > click on instead of a button? > > I don''t know of any ''HTML built in'' solution for this but here is one > that uses javascript > > http://www.thesitewizard.com/archive/textsubmit.shtml > > In general using a link to sumbit a form (using GET instead of a POST) > is a dangerous thing to do, especially if this form will change contents > in your database. this is due to web crawlers that may crawl your > website and click on links - and therefore your db contents may change > behind the scenes. using POST is always the better way. > > but I may have misunderstood your intention. > > anyway, HTH.Hi, thanks for your comments I basically don''t want to have to use the ugly grey button that comes with the submit_tag. Instead i want to have a button on my ''side menu'' that when clicked on will submit the form. I therefore just want to be able to use a link_to_function statement or something, where i am able to click on a piece of text and the form will be submitted. is this possible? -- 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 -~----------~----~----~----~------~----~------~--~---
James Smith wrote:> Alon wrote: >> What''s the motivation behind this? do you just want to have a link to >> click on instead of a button? >> >> I don''t know of any ''HTML built in'' solution for this but here is one >> that uses javascript >> >> http://www.thesitewizard.com/archive/textsubmit.shtml >> >> In general using a link to sumbit a form (using GET instead of a POST) >> is a dangerous thing to do, especially if this form will change contents >> in your database. this is due to web crawlers that may crawl your >> website and click on links - and therefore your db contents may change >> behind the scenes. using POST is always the better way. >> >> but I may have misunderstood your intention. >> >> anyway, HTH. > > Hi, thanks for your comments > > I basically don''t want to have to use the ugly grey button that comes > with the submit_tag. Instead i want to have a button on my ''side menu'' > that when clicked on will submit the form. I therefore just want to be > able to use a link_to_function statement or something, where i am able > to click on a piece of text and the form will be submitted. is this > possible?I feel your pain, but I''m not sure how to cleanly tell link_to to get all data from the form. The way previously suggested will work, and let me explain further. To submit a form from a link, make a form with a name (note: this can also be a start_form_tag, just make html_options { :name => "myname" }: <form name="myform" action="/path/to/action"> and the link you want to submit: <a href="javascript:document.myform.submit()">Submit Link</a> Now, I haven''t tried this myself, but let me know if you hit a snag and I''ll look into it. Also, I know this isn''t a pure rails solution, so if someone knows of one please let us know. ~Jimmy -- 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 -~----------~----~----~----~------~----~------~--~---
James Smith wrote:> I basically don''t want to have to use the ugly grey button that comes > with the submit_tag.You don''t have to. That''s what CSS is for. See: http://tom.me.uk/scripting/submit.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks very much for your help.
I did find the rails way to do it in the end, which was as follows:
Naming the form:
<%= start_form_tag({ :action => ''update'', :id =>
@input }, {:name =>
''myform''}) %>
Assigning submission to a button:
<% @button3 = link_to_function "Save", "myform.submit()"
%>
Thanks again, your comments were very helpful.
--
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
-~----------~----~----~----~------~----~------~--~---