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
Craig W. wrote:
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 O. 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 L. wrote:
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 ’ %>
<%= 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
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 ’ %>
<%= 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?
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