Based on the documentation:
link_to(name, options = {}, html_options = nil)
I would expect this is what you are looking for (note haven't tested
it):
link_to "link here", {new_object_path,
:method => :post, :confirm => 'Press OK'), #url
options
:class => "css_class", :id => "css_id" #html
options
HTH,
Nicholas
On Jul 7, 3:12 pm, James Byrne <[email protected]>
wrote:
> I have a link-to that I wish to look somewhat like this:
>
> link_to "link here", new_object_path,
> :method => :post, :confirm => 'Press OK', #url
> options
> :class => "css_class", :id => "css_id" #html
> options
>
> In any case I can either get the url_for options to work or the html
> options to work, but no matter how I arrange () or {} I cannot get both
> to work together. As far as I can determine, the api documents do not
> explicitly show this case either.
>
> What I want link_to to generate is:
>
> <a href="/objects/new"
> class="css_class"
> id="css_id"
> onclick="if (confirm('Press OK'))
> {
> var f = document.createElement('form');
> f.style.display = 'none';
> this.parentNode.appendChild(f);
> f.method = 'POST';
> f.action = this.href;
> f.submit();
> };
> return false;">link here</a>
>
> How is this done?
> --
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---