I thought about client side validation, too. I think this is an absolute must for FormFu::ExtJS. There are a few build-in validation constraints which can be accessed pretty easily via ExtJS iteself.

Like:
 - Required becomes { allowBlank: false}
 - Length becomes { maxLength: xx, minLength: xxx }

there even maxLengthText and allowBlankText which allow us to set the error message which is set in formfu.

There is also a regex config option. So we can implement even more constraints with that. Problem is, that there can be one regex per field only. So this is a big limitation, I'd say.

For now I would implement those easy to implement cases I mentioned above. For more complicated constraints like Constraint::Regex (this is a good example for a constraint which you cannot port
to JS because the regex engines are too different).

I use plugins in some of my components. They are great and you can even create a plugin inline:

plugin: new (function(){ function init(component) {} })()

this way we are independent from javascript which has to be initialized before the form is created.

Depending on your plans with client side validation on FormFu itself, this might be a good way because we can implement constraints which base on the "Others" contraint.

moritz


Am 25.03.2009 um 13:45 schrieb Mario Minati:

Hello Moritz,

do you have any means about client side validation in ExtJS?

ExtJS 2.2.1 doesn't provide a good way of defining a custom validation method. The only way I see is to overwrite the validateValue method which all form
field inherit from Ext.form.Field, but they provide allready specific
functionallity.

An approach would be to overWrite validateValue with a function that calls our FormFu constraints and filters and after they are passed invokes the original
validateValue code.

As I like the lazy instantiation I was looking for a way to do this poking
aroundwith function pointers.
What I came over is the config option plugins which accepts a plugin object(!)
not name.

What do you think?
Shall we create such a plugin which injects the necessary code to check forms.


Greets,

Mario Minati

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to