Reputation: 2031
Using Yii2, I realise that the template property for a CAPTCHA Widget only has an {image}
and {input}
token. My question is, How do I actually set the {label}
token via the template property and move it around, so maybe I want it under the {image}
for example?
I have tried the following: (setting the label inside the field
like you would an ordinary form field).
<?= $form->field($model, 'verifyCode', ['template' => '{label}'])->widget(Captcha::className(), [
'template' => '<div class="col-xs-12">{image}</div><div class="col-xs-12">{input}</div>',
'options' => ['placeholder' => 'CAPTCHA Code', 'class' => 'form-control']
]) ?>
Thanks!!
Upvotes: 0
Views: 2191
Reputation: 49
<?= $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::classname(),['options' => [
'placeholder' => 'Please enter the letters displayed above'
, 'Class' => 'form-control'
, 'style' => 'Top-margin: 10px;'
]])->label('Security Code')?>
Upvotes: 0