kartik-v / yii2-widget-activeform

Enhanced Yii2 active-form and active-field with full bootstrap styling support (sub repo split from yii2-widgets).
http://demos.krajee.com/widget-details/active-form
Other
64 stars 35 forks source link

Enhance ActiveForm to dynamically configure enabled, readonly and staticOnly flags #136

Closed stovesy closed 1 year ago

stovesy commented 2 years ago

I wonder if you would consider the following enhancement. It is an alteration to the protected function initDisability(&$options) in ActiveField.php The following will disable any attributes which are not active. I am using this to automatically disable unavailable fields as defined in scenarios.

$model = $this->model; if (!in_array($this->attribute, $model->activeAttributes())) { $options['disabled'] = true; }

Thanks for you time

kartik-v commented 1 year ago

Noting an enhancement - this may need additional settings at the form level.