Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Why is one field not validated?
public function rules(){
return [
[['name', 'last_name', 'email', 'phone'], 'required'],
];
}
<?= $form->field($model, 'name')->textInput(['placeholder' => Utils::placeholder($model, "name")])->label(false); ?>
<?= $form->field($model, 'last_name')->textInput(['placeholder' => Utils::placeholder($model, "last_name")])->label(false); ?>
<?= $form->field($model, 'phone')->textInput(['placeholder' => Utils::placeholder($model, "phone")])->label(false); ?>
<?= $form->field($model, 'email')->textInput(['placeholder' => Utils::placeholder($model, "email")])->label(false); ?>
last_name
is ignored by the validator. Tell me what the problem is, this is the first time
Answer the question
In order to leave comments, you need to log in
does not validate or ignore? Allows you to write an empty value? Then you need to look at the model. And a controller. For example, somewhere in beforeSave or beforeValidate there is logic that manipulates it. Maybe there are gaps? Lots of options. I advise you $model->save()
to do it after var_dump($model->last_name)
and check what is there in real life.
There is definitely a reason, there are a lot of options, but there is too little data to say anything specific.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question