我在这里使用了https://github.com/unclead/yii2-multiple-input/中的多种输入形式。 当我使用
library(dplyr)
library(tidyr)
df %>%
separate_rows(VAR2, sep = ";") %>%
group_by(VAR1) %>%
summarise(VAR2 = paste(unique(VAR2), collapse = ";"))
# VAR1 VAR2
# <fct> <chr>
#1 A 102 million
#2 B 0.1 million;2 million
它显示html5错误。当我在上面评论代码时,Yii未验证模型。我在这里做什么错了?
内部视图代码
'options' => [
'class' => 'input-priority',
'required' => 'required'
],
'attributeOptions' => [
'enableClientValidation' => true,
'validateOnChange' => true,
], 'enableError' => true,
型号代码
我已经指定
<?= $form->field($model->contacts, 'grids')->widget(MultipleInput::className(), [
'allowEmptyList' => false,
'min' => 1,
'addButtonPosition' => MultipleInput::POS_HEADER,
'addButtonOptions' => ['class' => 'btn btn-info', 'label' => '<i class="fa fa-plus"></i> Add Contact'],
'removeButtonOptions' => ['class' => 'btn btn-default', 'label' => '<i class="fa fa-trash"></i>'],
'columns' => [
[
'name' => 'person_name',
'title' => 'Person Name',
// 'options' => [
// 'class' => 'input-priority',
// 'required' => 'required'
// ],
// 'attributeOptions' => [
// 'enableClientValidation' => true,
// 'validateOnChange' => true,
// ], 'enableError' => true,
],
[
'name' => 'mobile',
'title' => 'Mobile',
],
[
'name' => 'email',
'title' => 'Email',
// 'options' => [
// 'class' => 'input-priority',
// 'required' => 'required'
// ],
// 'attributeOptions' => [
// 'enableClientValidation' => true,
// 'validateOnChange' => true,
// ], 'enableError' => true,
]
]
])->label(false); ?>
在模型和validate()中
public $grids;