Skip to content

HTML5 validation with required attribute #101

@samuelhwilliams

Description

@samuelhwilliams

This library injects the required attribute into rendered field HTML if the flag is set on the field in Python: https://github.com/LandRegistry/govuk-frontend-wtf/blob/main/govuk_frontend_wtf/wtforms_widgets.py#L28-L29

This causes the browser to pre-validate empty fields and reject the form submission/shows a native popup like this:
image

GOV.UK Design System says to turn off HTML5 validation.

We can bypass this by adding novalidate to the form tag - but just flagging in case this lib should also just not add the required attributes in the first place?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions