mem_form v0.8 Released

Category: Projects

Posted:

I’ve been doing a lot of django development recently and I am a fan of django (new) forms . I had been meaning to add some of Django’s validation niceties to mem_form. In response to some great feedback from Jeroen van Gorkum, I was finally motivated enough to make it happen.

With the new version, it is possible to register a function to do whatever validation is needed without have to duplicate most of the base field code. The “mem_form.store_value” event has been slightly altered so that if you return FALSE, it will behave as if validation has failed for the field.

Another now possible use case is the ability to use multiple fields to do some validation and display appropriate errors. This will make it possible to check that fields match, ensure dependent fields have appropriate values, or other checks that were previously only possible using javascript. This functionality is made possible by a new event, “mem_form.validate” that is only called on submit when all of the individual fields validated successfully.

file: mem_form.txt [109.66kB]
Category: Textpattern
download: 3631

Textpattern plugins can be downloaded from Bitbucket


file: mem_form.gz.txt [21.15kB]
Category: Textpattern
download: 1575

Textpattern plugins can be downloaded from Bitbucket

Below is an example plugin that will demonstrate how to use the new validation callbacks. Instructions are in the help.

file: mem_form_test.txt [4.17kB]
Category: Textpattern
download: 104

Textpattern plugins can be downloaded from Bitbucket

blog comments powered by Disqus