kartik-v / yii2-widgets

Collection of useful widgets for Yii Framework 2.0
http://demos.krajee.com/widgets
Other
558 stars 175 forks source link

Activefield does not show placeholder #322

Closed SSiwek closed 5 years ago

SSiwek commented 8 years ago

Hi

I try to set a placeholder, which is different to the attributeLabel

`$form = ActiveForm::begin([ 'id' => 'abelege-form-vertical', 'type' => ActiveForm::TYPE_INLINE, 'formConfig' => ['showErrors' => true] ]);

echo $form->field($model, 'scanfeld')->input(['placeholder' => 'Guten Morgen' ])->label(false);

`

That does not work. In the Form is still the attributeLabel shown.

Sven

Legion112 commented 5 years ago

I got the same error

kartik-v commented 5 years ago

@SSiwek This is a wrong configuration. Check the signature and usage of the ActiveField::input method. It has the first parameter as type and second parameter is options - the HTML attributes.

Correct usage is something like below:

echo $form->field($model, 'scanfeld')->input('text', ['placeholder' => 'Guten Morgen' ])->label(false);