neharohan.chopra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-22 15:38 UTC
Use submit tag but show a link
Hi, The submit_tag when used created a button by default. Is there a way by which i can create a link and use submit_tag and its properties. I have a form submission and i want that to work as it is but instead of button show a link in my page. Neha --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
something like link_to_function("submit", "$(''form_id'').submit();") should work, assuming you use prototype.js if not, replace $(...) with document.getElementById(''form_id'') and of course form_id has to be replaced with the actual id of your form -- 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 -~----------~----~----~----~------~----~------~--~---
neharohan.chopra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-22 15:56 UTC
Re: Use submit tag but show a link
While using the link_to_function i am getting this javascript <a onclick="Form.getInputs(this.form, null, ''commit'')[0].value ''add_another_criteria''; ; return false;" name="_commit" href="#">Add Term To Search</a> and with submit_tag i am getting thus <input type="submit" value="Add Term To Search" onclick="Form.getInputs(this.form, null, ''commit'')[0].value ''add_another_criteria''" name="_commit"/> How can i make this work. On Feb 22, 10:44 am, Thorsten Mueller <rails-mailing-l...@andreas- s.net> wrote:> something like > > link_to_function("submit", "$(''form_id'').submit();") > > should work, assuming you use prototype.js > if not, replace $(...) with document.getElementById(''form_id'') > and of course form_id has to be replaced with the actual id of your form > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
??? could you post the exact code you use ??? -- 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 -~----------~----~----~----~------~----~------~--~---
neharohan.chopra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-22 16:28 UTC
Re: Use submit tag but show a link
<%= hidden_field_tag(''commit'', ''add_another_criteria'') %> <%=link_to_function("Add Term To Search", :name => ''_commit'', :onclick => "Form.getInputs(this.form, null, ''commit'') [0].value = ''add_another_criteria''") %> <%= submit_tag(''Add Term To Search'', :name => ''_commit'', :onclick => "Form.getInputs(this.form, null, ''commit'') [0].value = ''add_another_criteria''") %> On Feb 22, 11:04 am, Thorsten Mueller <rails-mailing-l...@andreas- s.net> wrote:> ??? could you post the exact code you use ??? > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---