Form_for not rendering :html => {}

Hi I am trying to disable chrome’s html5 validations. I have added
:html => {:novalidate => ‘novalidate’}
to the form tag but when I check the form in the browser it is not there
and the validations keep me from submitting the form.

Here is all the relevant (I think) code.

Enter code here…form_for(:customer, url: {:action => ‘update’, :id =>
@customer.id, :account_settings => true},:html => {:novalidate =>
‘novalidate’}) do |f|
= render(:partial => ‘form’, :locals => {:f => f})

And this is what the form shows in HTML

Thank you.

On 27 January 2016 at 19:09, Mendel [email protected] wrote:

      = render(:partial => 'form', :locals => {:f => f})

And this is what the form shows in HTML

Are you saying the form tag does not show at all?
Is it ok in a different browser?
Have you got the = sign?
<%= form_for…

Colin

Sorry I put the wrong line of HTML, the form works:

Here it is in Chrome

What is interesting is that in Firefox the tag shows up and works fine:

On Jan 28, 2016, at 9:52 AM, Mendel S. [email protected] wrote:

Sorry I put the wrong line of HTML, the form works:

Here it is in Chrome

Is this looking at the raw HTML, or the rendered DOM? Chrome might be
being pedantic here, and refusing to show GET attributes in a POST form.
I recall somewhere in the mists of time that while that may work, it may
also not be standard and thus a conforming UA would be within its
rights to drop it, since POST trumps GET in all cases. See if the form
works uniformly when you add a hidden field to it with :account_settings
as the name, and remove the querystring from the form action. If you add
that with a f.hidden_field helper, then you will need to change your
controller to access the attribute from within the parent object’s
params hash, i.e.: params[:customer][:account_settings] rather than
params[:account_settings].

Walter

On 29 January 2016 at 17:42, Walter Lee D. [email protected]
wrote:

On Jan 28, 2016, at 9:52 AM, Mendel S. [email protected] wrote:

Sorry I put the wrong line of HTML, the form works:

Here it is in Chrome

Is this looking at the raw HTML, or the rendered DOM? Chrome might be being
pedantic here, and refusing to show GET attributes in a POST form. I recall
somewhere in the mists of time that while that may work, it may also not be
standard and thus a conforming UA would be within its rights to drop it, since
POST trumps GET in all cases. See if the form works uniformly when you add a
hidden field to it with :account_settings as the name, and remove the querystring
from the form action. If you add that with a f.hidden_field helper, then you will
need to change your controller to access the attribute from within the parent
object’s params hash, i.e.: params[:customer][:account_settings] rather than
params[:account_settings].

Further to this a good plan is to copy/paste the complete generated
html into the html validator
https://validator.w3.org/#validate_by_input

Often when different browsers behave differently for the a site is it
down to invalid html, which the two browsers are interpreting
differently.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs