Last active
August 28, 2019 17:17
-
-
Save fcaldarelli/7a4916141c853f91ac0e7f9a029db919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-md-4 col-xs-12"> | |
<div class="form-group" v-bind:class="{ 'has-error' : checkFieldError(pacchetto, 'nome') }"> | |
<label class="control-label">Nome</label> | |
<input type="text" class="form-control" v-model="pacchetto.nome" /> | |
<div class="help-block" v-html="textFieldError(pacchetto, 'nome')"></div> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkFieldError: function(model, field) | |
{ | |
return model.__errors && model.__errors[field] != undefined; | |
}, | |
textFieldError: function(model, field) | |
{ | |
return model.__errors && model.__errors[field] != undefined ? model.__errors[field] : ''; | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ '__errors' => $model->firstErrors ]; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="alert alert-danger" v-if=" '__errors' in model && Object.keys(model.__errors).length > 0 "> | |
<ul> | |
<li v-for="err in model.__errors">{{ err }}</li> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment