Skip to content

Move away from prototype/validation.js and towards native form validation #3054

Open
@loekvangool

Description

@loekvangool

Description (*)

https://github.com/OpenMage/magento-lts/blob/1.9.4.x/js/prototype/validation.js is handling form validation like entry-required, validate-email. This is wildly outdated since native options exist now: https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation. Native validation removes all responsibility from us, except for adding the <input> attributes like type=email. We no longer need to care about translations, UI, adherence to RFCs, etc.

Since it is native, we can also eject (part of the) translations of form validation errors in every page (new Translate):

protected function _getTranslateData()

Note that security is not affected, both the current and proposed methods are client-side.

Benefits

  • Don't validate forms like 2007
  • Validate forms like it's 2013 instead!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions