[html-formfu] Client side validation

Carl Franks fireartist at gmail.com
Thu Mar 26 09:29:26 GMT 2009


2009/3/25 Mario Minati <mario.minati at googlemail.com>:
> Hallo Carl,
>
> as you wrote you are working on the clientside validation and the auto_js
> branch gives a good idea of what is coming up.
>
> Might it be a good idea to put the pure javascript constraint/filter
> processing in a separate method which only gets the field value with other
> values and returns an error or the filtered result.
>
> This way everyone who is writing an FormFu Adaptor to a specific JS Framework,
> like Ext, could reuse this JS processing methods and needs only to create the
> surrounding functions to invoke them.
>
> Which way do you plan to realize constrains that have options, like Length.
> Currently as soultion would be to set a method_name that includes the options.
> An more elegant solution could be to create a constraint object that takes
> these options as parameters in the constructor.
>
> I'm willing to help as I need client side validation in ExtJS which is set via
> FormFu.

Hi,

As it happens, each of these 2 features, are 'in progress' in my
checked out directory...

Each unique constraint will have a JS object, that any options, such
as max(5) can be stored in.
That might be enough for you to work from.

I'll also be changing the constraint JS methods to more closely follow
the FormFu constraint methods, e.g.
    process()
    _process_when()
    constrain_value()

where constrain_value() receives the $value.

Adding much complication, are constraints that inherit from
_others.pm, as they have
    attach_errors_to_base()
    attach_errors_to_others()
    attach_errors_to()
to decide which fields errors are displayed next to.

Well, it certainly makes it interesting... ;)

Carl



More information about the HTML-FormFu mailing list