Add class to error placement check

This commit is contained in:
Marcus Moore 2023-11-14 16:12:47 -08:00
parent 20ae9dea19
commit 3ecdafa685
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -970,7 +970,7 @@
errorClass: 'help-block form-error',
errorElement: 'span',
errorPlacement: function(error, element) {
$(element).hasClass('select2')
$(element).hasClass('select2') || $(element).hasClass('js-data-ajax')
// If the element is a select2 then place the error above the input
? element.parents('.required').append(error)
// Otherwise place it after

View file

@ -4,7 +4,7 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7{{ ((isset($field_req)) || ((isset($required) && ($required =='true')))) ? ' required' : '' }}">
<select class="select2 js-data-ajax" data-endpoint="models" data-placeholder="{{ trans('general.select_model') }}" name="{{ $fieldname }}" style="width: 100%" id="model_select_id" aria-label="{{ $fieldname }}"{!! (isset($field_req) ? ' required ' : '') !!}{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
<select class="js-data-ajax" data-endpoint="models" data-placeholder="{{ trans('general.select_model') }}" name="{{ $fieldname }}" style="width: 100%" id="model_select_id" aria-label="{{ $fieldname }}"{!! (isset($field_req) ? ' required ' : '') !!}{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
@if ($model_id = old($fieldname, ($item->{$fieldname} ?? request($fieldname) ?? '')))
<option value="{{ $model_id }}" selected="selected">
{{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }}