Fix error field highlighting, closes #90

This commit is contained in:
Dane Everitt 2016-09-27 17:32:34 -04:00
parent c95a058638
commit a8fd7283ef
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 24 additions and 10 deletions

View file

@ -99,7 +99,7 @@
<div class="form-group col-md-6 col-xs-6">
<label for="memory_overallocate" class="control-label">Overallocate</label>
<div class="input-group">
<input type="text" name="memory_overallocate" class="form-control" value="{{ old('memory_overallocate') }}"/>
<input type="text" name="memory_overallocate" class="form-control" value="{{ old('memory_overallocate', 0) }}"/>
<span class="input-group-addon">%</span>
</div>
</div>
@ -124,7 +124,7 @@
<div class="form-group col-md-6 col-xs-6">
<label for="disk_overallocate" class="control-label">Overallocate</label>
<div class="input-group">
<input type="text" name="disk_overallocate" class="form-control" value="{{ old('disk_overallocate') }}"/>
<input type="text" name="disk_overallocate" class="form-control" value="{{ old('disk_overallocate', 0) }}"/>
<span class="input-group-addon">%</span>
</div>
</div>

View file

@ -200,9 +200,9 @@
@if (count($errors) > 0)
@foreach ($errors->all() as $error)
<?php preg_match('/^The\s(.*?)\s/', $error, $matches) ?>
<?php preg_match('/^The\s(.*?)\sfield/', $error, $matches) ?>
@if (isset($matches[1]))
$('[name="{{ $matches[1] }}"]').parent().parent().addClass('has-error');
$('[name="{{ str_replace(' ', '_', $matches[1]) }}"]').parent().parent().addClass('has-error');
@endif
@endforeach
@endif