I looked everywhere but couldn''t find it. I don''t want a submit_tag or image_submit_tag but a normal link that submits my form. Normally I would do this with a javascript like function sendForm () { document.forms[0].submit(); } but this doesn''t work with form_remote_tag link_to_function( ''Send'' , "sendform();") So the question is: how do I send my ajax form? Thanks in advance Peet -- Posted via http://www.ruby-forum.com/.
Peter, I did not try it myself, but I believe you can create helper similar to the submit_to_remote, but creating link instead of button looking at the source code 184: def submit_to_remote(name, value, options = {}) 185: options[:with] ||= ''Form.serialize(this.form)'' 186: 187: options[:html] ||= {} 188: options[:html][:type] = ''button'' 189: options[:html][:onclick] = "#{remote_function(options)}; return false;" 190: options[:html][:name] = name 191: options[:html][:value] = value 192: 193: tag("input", options[:html], false) 194: end it should be easy to create submit_to_remote_as_link and change "input" on line 193 to "a" and amend related attributes (like :type to :href) just an idea On 4/21/06, Peter <peter@negerzoen.be> wrote:> I looked everywhere but couldn''t find it. > > I don''t want a submit_tag or image_submit_tag but a normal link that > submits my form. > > Normally I would do this with a javascript like > > function sendForm () > { > document.forms[0].submit(); > } > > but this doesn''t work with form_remote_tag > > link_to_function( ''Send'' , "sendform();") > > So the question is: > how do I send my ajax form? > > Thanks in advance > Peet > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Emin Hasanov wrote:> Peter, I did not try it myself, but I believe you can create helper > similar to the submit_to_remote, but creating link instead of button > > looking at the source code > > 184: def submit_to_remote(name, value, options = {}) > 185: options[:with] ||= ''Form.serialize(this.form)'' > 186: > 187: options[:html] ||= {} > 188: options[:html][:type] = ''button'' > 189: options[:html][:onclick] = "#{remote_function(options)}; > return false;" > 190: options[:html][:name] = name > 191: options[:html][:value] = value > 192: > 193: tag("input", options[:html], false) > 194: end > > it should be easy to create submit_to_remote_as_link and change > "input" on line 193 to "a" and amend related attributes (like :type to > :href) > > just an ideaFor security reasons you really should use a post to submit the form, a link is an exposure. -- Posted via http://www.ruby-forum.com/.
there is nothing in the link that you can hide with the submit button On 4/22/06, James McCarthy <james2mccarthy@gmail.com> wrote:> > Emin Hasanov wrote: > > Peter, I did not try it myself, but I believe you can create helper > > similar to the submit_to_remote, but creating link instead of button > > > > looking at the source code > > > > 184: def submit_to_remote(name, value, options = {}) > > 185: options[:with] ||= ''Form.serialize(this.form)'' > > 186: > > 187: options[:html] ||= {} > > 188: options[:html][:type] = ''button'' > > 189: options[:html][:onclick] = "#{remote_function(options)}; > > return false;" > > 190: options[:html][:name] = name > > 191: options[:html][:value] = value > > 192: > > 193: tag("input", options[:html], false) > > 194: end > > > > it should be easy to create submit_to_remote_as_link and change > > "input" on line 193 to "a" and amend related attributes (like :type to > > :href) > > > > just an idea > > For security reasons you really should use a post to submit the form, a > link is an exposure. > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060421/62855409/attachment.html