about CActiveForm and jformvalidate extension
Rangel Reale has released a
new extension that adds client-side validation features to the CActiveForm Widget instead of using
jformvalidate, because as
he said,
jformvalidate is not compatible with CActiveForm. That's true !
So I did some tests :
- copy CActiveForm from the framework to the myWebApp/extensions/jformvalidate folder
- rename it EJFActiveForm
- replace all calls to CHtml:: with EHtml::
- update configuration
- call beginWidget('extensions.jformvalidate.EJFActiveForm')
With some adjustments to set
jformvalidate options, everything seemed to work fine '
out of the box' on simple forms (I've used the Contact form).
Ok, so next step would be to make some more tests and to release a new version of the
jformvalidate extension. So why am I not doing it right now instead of posting endless messages on the forum ? hum .. good question !
The thing is, I don't really see why ! I mean, which scenario could justify to mix pure client-side validation, ajax validation and pure server-side validation ? Moreover,
jformvalidate does support ajax validation rules (
as shown in this example) so if some attributes need to be validated on the server side, that's easy to achieve be defining an apropriate rule on the model.
If you need 3 form validation methods (client-side, ajax, pure server-side) you have 2 options :
- go with jformvalidate and a 'remote' validation rule
- use extension wvActiveForm
Consequently, and unless I really see strong positive points in doing so, I will not provide the
EJFActiveForm class in a next release of
jformvalidate.
ciao