Ticket #52 (assigned defect)

Opened 20 months ago

Last modified 20 months ago

Rails form_tag and form_for problems

Reported by: srackham Owned by: tec
Priority: major Milestone:
Component: lib Version:
Keywords: Cc:

Description

The rails Rails form_tag and form_for helpers do not work as expected (Rails 1.2.1, Markaby 0.5 plugin). Here's some Markaby code to illustrate the problems (the first two forms illustrate the broken behavior, the second two show workarounds):

p 'form_for BROKEN'
form_for(:article, :url => article_path(@article), :html => { :method => :put }) do |f|
  f.text_field(:title)          # BROKEN: Outputs nil.
  submit_tag "Update"           # OK
end

p 'form_tag BROKEN'
form_tag(article_path(@article), :method => :put) do
  text_field(:article, :title)  # BROKEN: Outputs into separate form.
  submit_tag('Update')          # OK
end

p 'form_for OK'
form_for(:article, :url => article_path(@article), :html => { :method => :put }) do |f|
  self << f.text_field(:title)  # OK.
  submit_tag "Update"           # OK
end

p 'form_tag OK'
form_tag(article_path(@article), :method => :put) do
  div do
    text_field(:article, :title)  # OK.
    submit_tag('Update')          # OK
  end
end

PS: Thanks for the lovely templating language -- I just can't go back to ERB after using Markaby.

Change History

Changed 20 months ago by tec

  • owner changed from somebody to tec
  • status changed from new to assigned
Note: See TracTickets for help on using tickets.