Filter support for forms

Bug #3281 reported by Wouter Bolsterlee
2
Affects Status Importance Assigned to Milestone
Anewt
In Progress
Wishlist
Wouter Bolsterlee

Bug Description

Part of this is already in the code, but it's not finished. Filters have basically the same layout as Validators, but they can filter (form) data. Useful if you want to strip whitespace, normalize text or other simple transformations.

The forms module should have an add_filter method.

Tags: form
Revision history for this message
Wouter Bolsterlee (uws) wrote :

Oh, and it should optionally block the validation of a form (to FORCE the user to reread the changed data)

Wouter Bolsterlee (uws)
Changed in anewt:
assignee: nobody → uws
status: New → Accepted
Wouter Bolsterlee (uws)
Changed in anewt:
importance: Medium → Low
Revision history for this message
Sander van Schouwenburg (Sandworm) (sander-sinaasappel) wrote :

Finally a fix for the oldest open bug in anewt.new.cxs:
 1463 Sander van Schouwenburg 2009-05-05
      [form] Filter support in form controls.

      You can add filters to AnewtFormControl's:
      1. $control->add_filter($filter);
      2. $control->add_filter($filter, $message);

      The first form silently modifies the value according to the filter. The second
      form checks whether the filter has modified the value, if so blocks validation
      and sets the error message to $message.

Revision history for this message
Sander van Schouwenburg (Sandworm) (sander-sinaasappel) wrote :

Note that filters are still in old anewt style.

Revision history for this message
Wouter Bolsterlee (uws) wrote :

Two remarks:

1. I'm not sure whether I like the API (notably the $message argument handling)
2. The validator classes should be reworked :)

Changed in anewt:
assignee: Wouter Bolsterlee (uws) (uws) → Sander van Schouwenburg (Sandworm) (sander-sinaasappel)
importance: Low → Wishlist
status: Confirmed → In Progress
Revision history for this message
Sander van Schouwenburg (Sandworm) (sander-sinaasappel) wrote :

In anewt.new.cxs
 1465 Sander van Schouwenburg 2009-07-20
      [filter] Changed filters module to new anewt style.

      Partially fixes #3181.

      Module now called 'filter', base filter now called AnewtFilter, init() changed
      to __constructor() and all filters prefixed with AnewtFilter.

      Also references the form module to Filter changed to the new style.

Revision history for this message
Wouter Bolsterlee (uws) wrote :

The code looks quite okay to me. I'll look into merging this (cherry picking, actually) soonish...

Changed in anewt:
assignee: Sander van Schouwenburg (Sandworm) (sander-sinaasappel) → Wouter Bolsterlee (uws) (uws)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers