Git Product home page Git Product logo

Comments (7)

josevalim avatar josevalim commented on July 28, 2024

I just added this behavior because I verified it works the same across different browsers. Could you please give more information on where they behave differently?

Unfortunately it does not have an option to disable such behavior, but a patch is welcome.

from simple_form.

hemju avatar hemju commented on July 28, 2024

Thanks for the quick reply.

Sorry, I wasn't clear enough. My concern is not the behavior Chrome (HTML 5) vs FF (HTML 5), my problem is the behavior HTML 5 vs not HTML 5. I use Chrome (with HTML 5) and FF (without), so in Chrome I cannot submit the form with an invalid email, in FF I can. So I now have to maintain HTML 5 form behavior and 'normal' behavior, which isn't really attractive.

from simple_form.

josevalim avatar josevalim commented on July 28, 2024

Why would you have to maintain two behaviors? On the server side, you should always assume the normal behavior, i.e. the user can send an invalid e-mail.

from simple_form.

hemju avatar hemju commented on July 28, 2024

in Chrome, I simply cannot submit the Email address, no message what's invalid. I don't know if I can customize the behavior, but I also don't want to customize it. In a normal case the form is submitted, the error message is rendered and the user gets the same response for every browser.
Of course, I always have to check on the server side if the input is valid.

from simple_form.

josevalim avatar josevalim commented on July 28, 2024

Woah, this sounds more like a Chrome buggy. In any case, I see what you mean. Feel free to provide a patch with tests and I will apply it. :)

In case you are wondering, here are the two places where we use HTML5:

http://github.com/plataformatec/simple_form/blob/master/lib/simple_form/inputs/string_input.rb#L12
http://github.com/plataformatec/simple_form/blob/master/lib/simple_form/inputs/numeric_input.rb#L10

You just need to skip setting the type, because the non HTML5 default will be set inside text_field.

from simple_form.

hemju avatar hemju commented on July 28, 2024

Probably it is a Chrome bug, since Chrome isn't very stable on the Mac.
When I was looking at the code to provide a patch, I realized that there is a much simpler way to achieve this:

<%= f.input :email, :input_html => {:type => "text"} %>

does exactly what I need.

from simple_form.

carlosantoniodasilva avatar carlosantoniodasilva commented on July 28, 2024

I guess you could use also something like:

<%= f.input :email, :as => :string %>

Please give it a try.

from simple_form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.