[Django] #17637: Client side validation classes for forms

23 views
Skip to first unread message

Django

unread,
Feb 4, 2012, 8:18:51 AM2/4/12
to django-...@googlegroups.com
#17637: Client side validation classes for forms
--------------------------+------------------------------------------------
Reporter: | Owner: nobody
karthikabinav | Status: new
Type: New | Version: 1.3
feature | Keywords: Forms , Client Side validation, js
Component: Forms | Has patch: 0
Severity: Normal | UI/UX: 1
Triage Stage: |
Unreviewed |
Easy pickings: 0 |
--------------------------+------------------------------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/17637>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 4, 2012, 5:36:46 PM2/4/12
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage:
validation, js | Unreviewed
Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by lrekucki):

* needs_docs: => 1
* needs_tests: => 1
* needs_better_patch: => 1


Old description:


> 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.

New description:


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.

--

Comment:

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 fallback for not widely supported features.

--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:1>

Django

unread,
Feb 4, 2012, 5:37:04 PM2/4/12
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js | Needs documentation: 1
Has patch: 0 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by lrekucki):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:2>

Django

unread,
Apr 9, 2022, 12:08:00 PM4/9/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: assigned

Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 0 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Marcelo Galigniana):

* owner: nobody => Marcelo Galigniana
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:3>

Django

unread,
Apr 9, 2022, 1:12:38 PM4/9/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: assigned
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0

-------------------------------------+-------------------------------------
Changes (by Marcelo Galigniana):

* needs_better_patch: 1 => 0
* ui_ux: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0


Comment:

[https://github.com/django/django/pull/15574 PR] was created.

--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:4>

Django

unread,
Apr 12, 2022, 2:40:23 AM4/12/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: assigned
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:5>

Django

unread,
Apr 28, 2022, 2:54:56 AM4/28/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: assigned
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Carlton Gibson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:6>

Django

unread,
Jun 6, 2022, 3:47:58 PM6/6/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: assigned
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Marcelo Galigniana):

The HTML5 pattern attribute does a re.fullmatch behind the scenes and our
RegexValidator does a re.search instead.

Should I create a new Validator?

Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:7>

Django

unread,
Jun 7, 2022, 4:33:02 AM6/7/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: closed
Component: Forms | Version: 1.3
Severity: Normal | Resolution: wontfix

Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: assigned => closed
* resolution: => wontfix


Comment:

Hi Marcelo. Thanks for the input on this old-one. Mariusz and I have been
discussing it intermittently… hence the slow follow-up.

In conclusion, I just can't see that the functionality here justifies the
additional passthrough kwarg on the `CharField`.
We can already specify `pattern` via the widget attributes, and a
validator if desired.
I'd much rather we used that API, than add an extra code path for the same
here.
In a project subclassing `CharField` to wrap your own options is likely.

As such I'm going to close this as `wontfix`. In the 10 years since this
was opened things have progressed — as you said on the PR, we don't need
the fallback — I think it was that which may have justified the ticket,
but I don't think ever in that time there's been a stable enough JS option
that we'd have wanted to include... — hence it sitting here I guess.

Even if we're not merging your fix, getting it to a conclusion is a good
step forwards, so thanks! 🎁

I hope that makes sense. C.

--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:8>

Django

unread,
Jun 7, 2022, 7:23:18 AM6/7/22
to django-...@googlegroups.com
#17637: Client side validation classes for forms
-------------------------------------+-------------------------------------
Reporter: karthikabinav | Owner: Marcelo
| Galigniana
Type: New feature | Status: closed
Component: Forms | Version: 1.3
Severity: Normal | Resolution: wontfix
Keywords: Forms , Client Side | Triage Stage: Accepted
validation, js |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Marcelo Galigniana):

Of course Carlton, totally makes sense! I'm happy to see another old one
closed!

Thanks you for the detailed answer!

🤗

--
Ticket URL: <https://code.djangoproject.com/ticket/17637#comment:9>

Reply all
Reply to author
Forward
0 new messages