The proper usage of form_tag nowadays is:
<% form_tag do %>
blah blah blah
<% end %>
Supposing I want to use form_tag inside a helper, e.g.
def search_form
form_tag do
... ??? ...
end
end
what would I put inside the block? In my other helpers, I build up a
string and return it.
- donald
Ball, Donald A Jr (Library) wrote:
The proper usage of form_tag nowadays is:
<% form_tag do %>
blah blah blah
<% end %>
Supposing I want to use form_tag inside a helper, e.g.
def search_form
form_tag do
... ??? ...
end
end
what would I put inside the block? In my other helpers, I build up a
string and return it.
- donald
I've been wondering this too! Nothing I've done seems to work.
Only downside I've found to the new way.
- Chris
11155
(-- --)
3
Ball, Donald A Jr (Library) wrote:
The proper usage of form_tag nowadays is:
<% form_tag do %>
blah blah blah
<% end %>
Supposing I want to use form_tag inside a helper, e.g.
def search_form
form_tag do
... ??? ...
end
end
what would I put inside the block? In my other helpers, I build up a
string and return it.
- donald
I know this post is too old, but I haven't seen anyone answering this
question, so here I go.
I found I could use a form_tag inside a helper method this way:
def search_form
form_tag do
(
text_field_tag( :name ) +
text_field_tag( :lastname )
)
end
I think there should be a cleaner way, but at least this works.
Tyler
(Tyler)
4
That didn't quite work for me, but I have made it work using concat:
def search_form
form_tag do
concat (
text_field_tag( :name ) +
text_field_tag( :lastname )
)
end
11155
(-- --)
5
Tyler wrote:
That didn't quite work for me, but I have made it work using concat:
def search_form
form_tag do
concat (
text_field_tag( :name ) +
text_field_tag( :lastname )
)
end
You shouldn't need the concat. It's not actually doing anything.
Best,