CActiveForm class file.
performAjaxValidation
is the main extra code we add to our traditional model creation action code. In this method, we check if the request is submitted via AJAX by the 'user-form'. If so, we validate the model and return the validation results. We may call the same method in model update action. On the client side, an input field may be in one of the four states: initial (not validated), validating, error and success. To differentiate these states, CActiveForm automatically assigns different CSS classes for the last three states to the HTML element containing the input field. By default, these CSS classes are named as 'validating', 'error' and 'success', respectively. They may be changed by configuring the options} property or specifying in the error} method. Sometimes, we may want to limit the AJAX validation to certain model attributes only. This can be achieved by setting the model with a scenario that is specific for AJAX validation. Then only list those attributes that need AJAX validation in the scenario in CModel::rules()} declaration. There are some limitations of CActiveForm regarding to its AJAX validation support. First, it does not validate with file upload fields. Second, it should not be used to perform validations that may cause server-side state change. For example, it is not suitable to perform CAPTCHA validation done by CCaptchAction} because each validation request will increase the number of tests by one. Third, it is not designed to work with tabular data input for the moment. Because CActiveForm relies on submitting the whole form in AJAX mode to perform the validation, if the form has a lot of data to submit, the performance may not be good. In this case, you should design your own lightweight AJAX validation. Qiang Xue qiang.nosp@m..xue.nosp@m.@gmai.nosp@m.l.co.nosp@m.m 1.1.1