Please note that it is advisable that you also perform server-side validation for your inputs.However, it typically makes for a better user experience to be able to validate some things without submitting the form.result mentioned above the action will be executed while AJAX request is active and respond with JSON providing a new URL to load.Otherwise the AJAX response will be empty and the form must be submitted a 2nd time but as usual request, not AJAX.This is achieved by grouping together validation functions in "modules", making it possible to load only those functions that's needed to validate a particular form.This plugin is available through cdnjs, npm, bower and github.
Given a model populated with user inputs, you can validate the inputs by calling the yii\base\Model::validate() method.
We will also do two more things when the user submits the form: The next step is to create a function that will do all the checking for us (which is much more convenient than writing the same code over and over again). Now, we can check each $_POST variable with the test_input() function, and the script looks like this: Notice that at the start of the script, we check whether the form has been submitted using $_SERVER["REQUEST_METHOD"].
If the REQUEST_METHOD is POST, then the form has been submitted - and it should be validated.
If you want to allow any kind of letters (not only A-Z) you're looking for the letternumeric validator.
Validate qty of checkboxes in a group (same name) have been checked, using min, max or range.