My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 1763: Enhanced CActiveForm to do client-side javascript validation before sending ajax request
3 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  qiang.xue
Closed:  Mar 2011

Sign in to add a comment
Reported by, Nov 13, 2010
What steps will reproduce the problem?

What is the expected output? 
1.Do client-side validation for simple validator, such as: required, length,email,url , etch.
2.PHP backend should verify the changed attributes of model only for ajax validation.

What do you see instead?
1. Never, all validation send to PHP backend via ajax directly.
2. Never, any validation trigged by changing single attribute  will cause to run for all rules.

What version of the product are you using? 
Yii-1.1.5-dev(svn up to date)

On what operating system?

Please provide any additional information below.

I have written an extension to CActiveForm to solved these problems, see extension page:

I hope that Yii offical dev team can integrate them in the near future.

13.7 KB   View   Download
Jan 15, 2011
Project Member #1 qiang.xue
Set for next milestone.
Labels: Milestone-1.1.7
Mar 14, 2011
Project Member #2 qiang.xue
Need more time. A better way to organize the code is probably to put the js code generation logic in each individual validator class. By doing so, the active form class will have less coupling with validators.
Status: Accepted
Labels: -Milestone-1.1.7 Milestone-1.1.8 Type-Enhancement
Mar 14, 2011
I think client side validations should also be supported even without ajax submit, as this is a normally required to validate on client side. There are some extensions available for this as well, but making it a part of cActive form will be good.
Mar 15, 2011
yes, I thinks it is a better way to add a new interface method function into base validator class, and CActiveForm call this method to generate logic Javascript code.
Mar 17, 2011
One more suggestion is to keep this client side validation optional, so user can enable or disable client side validation as required.
Mar 23, 2011
Project Member #6 qiang.xue
I have implemented a prototype. Would you please help to test it and leave your feedback? We will support this in 1.1.8. Thanks.
31.0 KB   View   Download
2.9 KB   View   Download
8.1 KB   View   Download
12.2 KB   View   Download
Mar 24, 2011
Project Member #7 qiang.xue
This issue was closed by revision r3113.
Status: Fixed
Mar 24, 2011
Project Member #8 qiang.xue
(No comment was entered for this change.)
Labels: -Milestone-1.1.8 Milestone-1.1.7
Sign in to add a comment

Powered by Google Project Hosting