I’m generating reports in various format (html, text, pdf etc) and
currently I’m using formatted_foo_path(@foo, :format) to get a report
in specific format. However, I’d like to provide users a choice of
format through simple select box. How to do it?
I could use javascript to change extension of the form action url, but
is there non-javascript solution?
I’m generating reports in various format (html, text, pdf etc) and
currently I’m using formatted_foo_path(@foo, :format) to get a report
in specific format. However, I’d like to provide users a choice of
format through simple select box. How to do it?
I could use javascript to change extension of the form action url, but
is there non-javascript solution?
I have not done what you are trying to accomplish, but I think the
format just comes in as a param. params[:format] I believe. If that is
the case, you should be able to use a select and give it the html name
‘format’.
But, on second thought I suppose it’s to late to do that for the form
that is displayed. So scratch that previous post. Maybe javascript is
your only plausible route.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.