user2707590
user2707590

Reputation: 1126

Yii2 and bootstrap field behaviour

Is it possible to modify the behaviur that an ActiveField in Yii2 has?

Yii2 has a default template to create and display input tags along with their errors/hints etc.

string $template = "{label}\n{input}\n{hint}\n{error}"

If i create a field as follows:

<?= $form->field($model, 'email')->textInput() ?>

using the above template, the label will be displayed followed by the input tag and the error tag (hint is optional).

But using bootstrap i want to display the error in a popover and not in the error tag which is generated. and if there are no errors, then a default message appear in the popover like "what is your email address?"

Thanks :)

Upvotes: 0

Views: 453

Answers (1)

ccdiego5
ccdiego5

Reputation: 666

well i'm change .has-error position from the site.css "{label}\n{input}\n{hint}\n{error}"

.has-error input{
    background-color: rgba(231, 76, 60, 0.11119);
}
.has-error > .help-block {
    float: right;
    margin-right: 1vh;
    margin-top: -9.2vh;    
}

with this you well change this

default Yii2 Error

For this:

My css

Upvotes: 1

Related Questions