How do I use... <%= link_to "All Facilities", :action => ''fac_log_all'' %> if I add :target => "_new" that is just a parameter and not a directive. I just want reports to print into a separate window. How do I do that? It''s not clear at all to me Craig
<%= link_to "All Facilities", {:action =>
''fac_log_all''},{"target"=>"_new"} %>
This should work.
_Kevin
On Tuesday, March 07, 2006, at 12:44 PM, Craig White
wrote:>How do I use...
>
><%= link_to "All Facilities", :action =>
''fac_log_all'' %>
>
>if I add :target => "_new" that is just a parameter and not a
>directive.
>
>I just want reports to print into a separate window. How do I do that?
>It''s not clear at all to me
>
>Craig
>
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
--
Posted with http://DevLists.com. Sign up and save your time!
Craig White wrote:> How do I use... > > <%= link_to "All Facilities", :action => ''fac_log_all'' %> > > if I add :target => "_new" that is just a parameter and not a > directive. > > I just want reports to print into a separate window. How do I do that? > It''s not clear at all to me > >Try adding {} brackets around :action and then add , :target => "_new" <%= link_to "All Facilities", {:action => ''fac_log_all''}, {:target => ''_new''} %> # ^^ link options ^^ ^^ html opts ^^
On Tue, 2006-03-07 at 20:04 +0000, Kevin Olbrich wrote:> <%= link_to "All Facilities", {:action => > ''fac_log_all''},{"target"=>"_new"} %> >---- indeed it does - thanks Kevin Craig
On Tue, 2006-03-07 at 15:10 -0500, Berin Loritsch wrote:> Craig White wrote: > > How do I use... > > > > <%= link_to "All Facilities", :action => ''fac_log_all'' %> > > > > if I add :target => "_new" that is just a parameter and not a > > directive. > > > > I just want reports to print into a separate window. How do I do that? > > It''s not clear at all to me > > > > > > Try adding {} brackets around :action and then add , :target => "_new" > > <%= link_to "All Facilities", {:action => ''fac_log_all''}, {:target => ''_new''} %> > # ^^ link options ^^ ^^ html opts ^^---- perfect - and I actually understand it. Similar doesn''t work for ''start_form_tag'' <%= start_form_tag {:action => ''fac_log''}, {:target => "_new"} %> <%= options = [[''Select a Facility'', '''']] + @facilities.collect { |fac| [fac.name, fac.id] } select ''report'', ''facility_id'', options %> <%= submit_tag '' Go '' %></td> <%= end_form_tag %> as any braces in <%= start_form_tag :action => ''fac_log'' %> seem to cause syntax errors Is there a way to accomplish the same (new window) here? Craig
Jonathan Viney
2006-Mar-08 00:47 UTC
[Rails] Re: form_tag - directing to new target window
You need brackets round the whole statement. I guess the interpreter
can''t tell if you''re passing a block or a hash, so...
form_tag({ :action => ''fac_log'' }, { :target =>
''_new'' })
-Jonny.
> Similar doesn''t work for ''start_form_tag''
>
> <%= start_form_tag {:action => ''fac_log''}, {:target
=> "_new"} %>
> <%= options = [[''Select a Facility'',
'''']] +
> @facilities.collect {
> |fac| [fac.name, fac.id] }
> select ''report'', ''facility_id'',
options %>
> <%= submit_tag '' Go '' %></td>
> <%= end_form_tag %>
>
> as any braces in <%= start_form_tag :action =>
''fac_log'' %>
> seem to cause syntax errors
>
> Is there a way to accomplish the same (new window) here?
--
Posted via http://www.ruby-forum.com/.
Thank you - that clearly worked. This is not the first time I''ve said this on this list... It is incredibly difficult to ascertain when/if/which <=> brackets/braces/parens are required in rails Craig On Wed, 2006-03-08 at 01:47 +0100, Jonathan Viney wrote:> You need brackets round the whole statement. I guess the interpreter > can''t tell if you''re passing a block or a hash, so... > > form_tag({ :action => ''fac_log'' }, { :target => ''_new'' }) > > -Jonny. > > > Similar doesn''t work for ''start_form_tag'' > > > > <%= start_form_tag {:action => ''fac_log''}, {:target => "_new"} %> > > <%= options = [[''Select a Facility'', '''']] + > > @facilities.collect { > > |fac| [fac.name, fac.id] } > > select ''report'', ''facility_id'', options %> > > <%= submit_tag '' Go '' %></td> > > <%= end_form_tag %> > > > > as any braces in <%= start_form_tag :action => ''fac_log'' %> > > seem to cause syntax errors > > > > Is there a way to accomplish the same (new window) here? > >