小编WpT*_*s24的帖子

YII2:添加动态表单字段及其验证

我正在添加动态表单字段onChange of dropdown.两种类型的字段都来自不同的模型,并在不同的表中转到数据库.我已经在模型中定义了验证规则.

但验证工作不正常.我的代码如下:

型号:

<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%membership_features}}".
 *
 * @property integer $id
 * @property string $title
 * @property string $type
 * @property integer $is_new
 * @property integer $status
 * @property integer $is_deleted
 * @property string $created_date
 * @property string $modified_date
 *
 * @property MembershipFeaturesValue[] $membershipFeaturesValues
 */
class MembershipFeatures extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */

    public $value=[];
    public static function tableName()
    {
        return '{{%membership_features}}';
    }

    /**
     * …
Run Code Online (Sandbox Code Playgroud)

php dynamic yii2 yii2-advanced-app

11
推荐指数
2
解决办法
2万
查看次数

标签 统计

dynamic ×1

php ×1

yii2 ×1

yii2-advanced-app ×1