Tutorial by Examples

Few people have issue regarding error message not displaying if existing value is being entered in textbox. So, For Example I'm not allowing user to enter existing email. signup.php (Page where you wanted to sign up new user without existing email id) Remove use yii\bootstrap\ActiveForm; (if p...
Some people have issues regarding error messages not being displayed if an existing value is being entered. For example I'm not allowing a user signup with an existing email. View <?php ...................... <?= $form->field($modelUser, 'email')->textInput(['class'=&gt...
By default error message appears below textbox in <div class="help-block"></div> on keyUp or after pressing submit button if any validation constraints aren't met. Sometimes we want a message on submit only i.e. no validation at onKeyup event. Let's check yii2/widgets/ActiveF...
Using scenario you can perform validation on different situation Define scenario in model class class User extends \yii\db\ActiveRecord { public static function tableName() { return 'user_master'; } // define validation in rule() function public ...
Since Yii2 version 2.0.4 there is the EachValidator used to validate each item in an array. [ // ... other rules ['userIDs', 'each', 'rule' => ['integer']], ] The ['integer'] part can be every other validator object that Yii2 offers and can hold the specific arguments for the valid...

Page 1 of 1