C
C
Carlos Rodriguez2015-01-17 11:00:09
Yii
Carlos Rodriguez, 2015-01-17 11:00:09

Yii2. Active Record work with multiple fields?

<div class="form-group field-signupcompanyform-phone">
<label class="control-label">Телефон</label>
<input type="text" name="SignupCompanyForm[phone][]" class="form-control">
<div class="help-block"></div>
<input type="text" name="SignupCompanyForm[phone][]" class="form-control phone-group">
<input type="text" name="SignupCompanyForm[phone][]" class="form-control phone-group">
<input type="text" name="SignupCompanyForm[phone][]" class="form-control phone-group">
</div>

doing $model->load(Yii::$app->request->post())fills all properties except $phone

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Filatov, 2015-01-17
@crtv

1. Add phone to the validation rules
2. Define the SignupCompanyForm::setPhone($phones = []) method, in which the passed data will be processed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question