Opened 13 years ago

Last modified 3 years ago

#17637 closed New feature

Client side validation classes for forms — at Version 1

Reported by: karthikabinav Owned by: nobody
Component: Forms Version: 1.3
Severity: Normal Keywords: Forms, Client Side validation, js
Cc: Carlton Gibson Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Łukasz Rekucki)

Having client side javascript validation for forms having common fields like username having only alphanumerics or password and Confirm password fields matching by providing a validation class.

For example a user should be able to do something like :

forms.TextField(validators ="usernameValidation")

And automatically a javascript validation for this form field should be in place.

One way to do it could be using HTML5 attributes like ticket #16304.

Change History (2)

by karthikabinav, 13 years ago

Attachment: pattern_charfield.patch added

Supply accepted characters as a regular expression in CharField forms. Uses HTML5 attribute 'pattern' to provide the client side validation.

comment:1 by Łukasz Rekucki, 13 years ago

Description: modified (diff)
Needs documentation: set
Needs tests: set
Patch needs improvement: set

Per discussion on django-developers, I think we can accept this on principal (not the patch itself, as it doesn't have tests or docs). IMHO, best approach would be to use HTML5 features + provide some simple JavaScript fall back for not widely supported features.

Last edited 10 years ago by johnhomes (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top