H All, I have run into a very interesting issue. On one of my apps, after upgrading from 2.3 to 3.0, the form validation started to escape html. Normally what should happen when you submit a form and one of the fields fails validation that field would get surrounded with a <div class="fieldWithErrors"> and so on. That seems to be broken in my app and what I get is the correct html but it is escaped, so in the browser I see the actual html code instead of the input control. For instance, this excerpt from the html source: <div class="field"> <span class="fieldWithErrors"><label for="customer_first_name">First name</label></span><br /> <span class="fieldWithErrors"><input id="customer_first_name" name="customer[first_name]" size="30" type="text" value="" /></span> </div> I verified that on a newly created app everything works fine so this seems to be a configuration issues after upgrading from 2.3.9 to 3.0. Any help will be greatly appreciated. Raf -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rafael Szuminski wrote in post #947092:> H All, > > I have run into a very interesting issue. On one of my apps, after > upgrading > from 2.3 to 3.0, the form validation started to escape html. Normally > what > should happen when you submit a form and one of the fields fails > validation > that field would get surrounded with a <div class="fieldWithErrors"> and > so > on. That seems to be broken in my app and what I get is the correct html > but > it is escaped, so in the browser I see the actual html code instead of > the > input control. For instance, this excerpt from the html source: > > <div class="field"> > <span class="fieldWithErrors"><label > for="customer_first_name">First > name</label></span><br /> > > <span class="fieldWithErrors"><input > id="customer_first_name" > name="customer[first_name]" size="30" > type="text" value="" /></span> > > </div> > > > I verified that on a newly created app everything works fine so this > seems > to be a configuration issues after upgrading from 2.3.9 to 3.0. > > Any help will be greatly appreciated. > > RafRaf, I''m having the exact same problem. Has this problem been resolved? What was the solution? Thank you very much. LBfromLA -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 9 October 2010 01:18, Rafael Szuminski <raf1hh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> H All, > I have run into a very interesting issue. On one of my apps, after upgrading > from 2.3 to 3.0, the form validation started to escape html. Normally what > should happen when you submit a form and one of the fields fails validation > that field would get surrounded with a <div class="fieldWithErrors"> and so > on. That seems to be broken in my app and what I get is the correct html but > it is escaped, so in the browser I see the actual html code instead of the > input control. For instance, this excerpt from the html source: > > <div class="field"> > <span class="fieldWithErrors"><label > for="customer_first_name">First > name</label></span><br /> > > <span class="fieldWithErrors"><input > id="customer_first_name" name="customer[first_name]" > size="30" type="text" value="" > /></span> > > </div> > > I verified that on a newly created app everything works fine so this seems > to be a configuration issues after upgrading from 2.3.9 to 3.0. > Any help will be greatly appreciated.Strings are HTML-escaped by default in Rails 3, so if you have a helper that generates HTML then you need to explicitly tell Rails that it is ''HTML-safe''. Are you using a helper or perhaps a plugin to generate your form HTML? If so, it could be that it needs updating to mark HTML as HTML-safe. (This would also explain why a newly-generated Rails 3 app which doesn''t have that helper/plugin is generating this HTML correctly.) Chris -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.