0
我有这样的代码在我看来如何限制redactor限制器插件上的max char?
<div class="col-xs-6">
<?php echo $form->field($model, 'deskripsi_produk')->widget(Redactor::className(),['clientOptions'=>['autoresize'=>'true', 'limiter' => 20, 'plugins' => ['limiter'], 'buttons'=> ['html', 'formatting', 'bold', 'italic','underline','lists','horizontalrule'],]]);?>
</div>
它可以限制20个字符,但如何限制文本区域的模型来代替具体的数量限制定义最大字符串?
这里是我的模型
class TbProduk extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public $image;
public static function tableName()
{
return 'tb_produk';
}
public function rules()
{
return [
...
[['deskripsi_produk'], 'string', 'max' => 2000],
[['deskripsi_produk'], 'checkDesc'],
...
];
}
}
哪里是在模型中定义的最大长度? – topher
@topher问题已更新 –