Repository: jeroennoten/Laravel-AdminLTE (language: php)

Issue:
[FEATURE] Add support to old() on bladeX components
### Is your request related to a problem? Please describe.
Currently, in each of Create or Edit blade file, we have to define values for input ourselves which I generally do like this.

```xml
model-edit.blade.php
<x-adminlte-input name="phone" value="{{ old('phone') ?? $model->phone ?? '' }}"/>
```

```xml
model-create.blade.php
<x-adminlte-input name="phone" value="{{ old('phone') ?? '' }}"/>
```
The `old()` function retrieves the submitted value in case of validation errors. 

Copying and pasting above code (as is common during development) can cause mistakes since phone field is used thrice.

### Describe the solution you'd like
I would like that we should be able to attach a model like this.

```xml
model-create.blade.php
<x-adminlte-input name="phone" :model="$model"/>
```
Then in our component we generate the value attribute if model is defined (using name field of the model)
```php
@if($model)
value="{{ old($name) ?? $model->$name ?? '' }}"
@endif
```

This can be useful in input as well as textarea and select fields (for selected option)


Discussion / hints:
I like that idea too. In general I added the values to all x-blade components myself because repopulating is not really working right now. 

But just as a tip. You don't have to hesitate with extra checks if variable is given. The old() method is having a second param you could use.

Example
`value="{{ old('phone', $data->phone) }}"`

@adwiv I will address this after the first release with components, so I don't keep delaying it.
@adwiv I will start with this one soon. For the moment, I don't like the fact that the model's property to lookup for the value is coupled with the `name` HTML attribute. That will create problems in at least two situations:

- When you need to use an HTML `name` attribute that is different from the property of the model holding the value
- When you need to use a complex HTML `name` attribute, as we already discussed on #861 

So, maybe we can add a new `enable-old-value` property to the form components. When setting it to `true`, the HTML `value` property may be calculated from the one you have provided for the component, as next:

```blade
@isset($enableOldValue)
    value="{{ old($name, $attributes->get('value') ?? '' ) }}"
@endisset
```

This way, you may use the components you have provided like:

```blade
model-edit.blade.php
<x-adminlte-input name="phone" value="{{ $model->phone_number }}" enable-old-value/>
```

Note you may need to ensure `$model->phone_number` always exists, or use `$model->phone_number ?? ''` instead.

```blade
model-create.blade.php
<x-adminlte-input name="phone" enable-old-value/>
```

Without the `enable-old-value` property you still can implement your own logic to create the `value`, so you can cover very particular situations...

What do you think?

> **SELF NOTE 1**: Add `old()` support for all form components is not trivial. Input file component won't work with `old()` helper, see [here](https://stackoverflow.com/questions/6842571/can-you-re-populate-file-inputs-after-failed-form-submission-with-php-or-javascr). Also selects components works different, we need to apply the `selected` attribute to the submitted option again (and this is even more hard for selects with the `multiple` attribute). Other advanced components that relays on particular plugins will also require special treatment.

Fix patch:
diff --git a/resources/views/components/form/date-range.blade.php b/resources/views/components/form/date-range.blade.php
index 597adaef..f9b4972a 100644
--- a/resources/views/components/form/date-range.blade.php
+++ b/resources/views/components/form/date-range.blade.php
@@ -28,6 +28,15 @@
             }
         @endisset
 
+        {{-- Add support to auto select the previous submitted value --}}
+
+        @if($errors->any() && $enableOldSupport)
+            let oldRange = @json($getOldValue($errorKey));
+            oldRange = oldRange.split(" - ");
+            usrCfg.startDate = oldRange.length > 0 ? oldRange[0] : null;
+            usrCfg.endDate = oldRange.length > 1 ? oldRange[1] : null;
+        @endif
+
         $('#{{ $id }}').daterangepicker(usrCfg);
     })
 
diff --git a/resources/views/components/form/input-color.blade.php b/resources/views/components/form/input-color.blade.php
index e072a280..0a560de0 100644
--- a/resources/views/components/form/input-color.blade.php
+++ b/resources/views/components/form/input-color.blade.php
@@ -31,6 +31,12 @@
         $('#{{ $id }}').colorpicker( @json($config) )
             .on('change', setAddonColor);
 
+        {{-- Add support to auto select the previous submitted value --}}
+
+        @if($errors->any() && $enableOldSupport)
+            $('#{{ $id }}').val( @json($getOldValue($errorKey)) ).change();
+        @endif
+
         // Set the initial color for the addon.
 
         setAddonColor();
diff --git a/resources/views/components/form/input-slider.blade.php b/resources/views/components/form/input-slider.blade.php
index 60865432..900bf973 100644
--- a/resources/views/components/form/input-slider.blade.php
+++ b/resources/views/components/form/input-slider.blade.php
@@ -18,30 +18,33 @@
 
         // Check for disabled attribute (alternative to data-slider-enable).
 
-        @isset($attributes['disabled'])
+        @if($attributes->has('disabled'))
             usrCfg.enabled = false;
-        @endisset
+        @endif
 
         // Check for min, max and step attributes (alternatives to
         // data-slider-min, data-slider-max and data-slider-step).
 
-        @isset($attributes['min'])
-            usrCfg.min = {{ $attributes['min'] }};
-        @endisset
+        @if($attributes->has('min'))
+            usrCfg.min = Number( @json($attributes['min']) );
+        @endif
 
-        @isset($attributes['max'])
-            usrCfg.max = {{ $attributes['max'] }};
-        @endisset
+        @if($attributes->has('max'))
+            usrCfg.max = Number( @json($attributes['max']) );
+        @endif
 
-        @isset($attributes['step'])
-            usrCfg.step = {{ $attributes['step'] }};
-        @endisset
+        @if($attributes->has('step'))
+            usrCfg.step = Number( @json($attributes['step']) );
+        @endif
 
         // Check for value attribute (alternative to data-slider-value).
+        // Also, add support to auto select the previous submitted value.
 
-        @isset($attributes['value'])
-            usrCfg.value = {{ $attributes['value'] }};
-        @endisset
+        @if($attributes->has('value') || ($errors->any() && $enableOldSupport))
+            let value = @json($getOldValue($errorKey, $attributes['value']));
+            value = value.split(",").map(Number);
+            usrCfg.value = value.length > 1 ? value : value[0];
+        @endif
 
         // Initialize the plugin.
 
diff --git a/resources/views/components/form/input-switch.blade.php b/resources/views/components/form/input-switch.blade.php
index 5f2b6461..a123849a 100644
--- a/resources/views/components/form/input-switch.blade.php
+++ b/resources/views/components/form/input-switch.blade.php
@@ -15,6 +15,13 @@
 
     $(() => {
         $('#{{ $id }}').bootstrapSwitch( @json($config) );
+
+        {{-- Add support to auto select the previous submitted value --}}
+
+        @if($errors->any() && $enableOldSupport)
+            let oldState = @json((bool)$getOldValue($errorKey));
+            $('#{{ $id }}').bootstrapSwitch('state', oldState);
+        @endif
     })
 
 </script>
diff --git a/resources/views/components/form/select-bs.blade.php b/resources/views/components/form/select-bs.blade.php
index 061f6cbf..5030f06b 100644
--- a/resources/views/components/form/select-bs.blade.php
+++ b/resources/views/components/form/select-bs.blade.php
@@ -17,6 +17,13 @@
 
     $(() => {
         $('#{{ $id }}').selectpicker( @json($config) );
+
+        {{-- Add support to auto select old submitted values --}}
+
+        @if($errors->any() && $enableOldSupport)
+            let oldOptions = @json(collect($getOldValue($errorKey)));
+            $('#{{ $id }}').selectpicker('val', oldOptions);
+        @endif
     })
 
 </script>
diff --git a/resources/views/components/form/text-editor.blade.php b/resources/views/components/form/text-editor.blade.php
index a09bdd62..6a0ffe48 100644
--- a/resources/views/components/form/text-editor.blade.php
+++ b/resources/views/components/form/text-editor.blade.php
@@ -5,7 +5,7 @@
     {{-- Summernote Textarea --}}
     <textarea id="{{ $id }}" name="{{ $name }}"
         {{ $attributes->merge(['class' => $makeItemClass()]) }}
-    >{{ $slot }}</textarea>
+    >{{ $getOldValue($errorKey, $slot) }}</textarea>
 
 @overwrite
 
diff --git a/src/View/Components/Form/DateRange.php b/src/View/Components/Form/DateRange.php
index c299b382..8fd50b75 100644
--- a/src/View/Components/Form/DateRange.php
+++ b/src/View/Components/Form/DateRange.php
@@ -4,6 +4,8 @@
 
 class DateRange extends InputGroupComponent
 {
+    use Traits\OldValueSupportTrait;
+
     /**
      * The DateRangePicker plugin configuration parameters. Array with
      * key => value pairs, where the key should be an existing configuration
@@ -31,7 +33,8 @@ class DateRange extends InputGroupComponent
     public function __construct(
         $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
         $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
-        $errorKey = null, $config = [], $enableDefaultRanges = null
+        $errorKey = null, $config = [], $enableDefaultRanges = null,
+        $enableOldSupport = null
     ) {
         parent::__construct(
             $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
@@ -40,6 +43,7 @@ public function __construct(
 
         $this->config = is_array($config) ? $config : [];
         $this->enableDefaultRanges = $enableDefaultRanges;
+        $this->enableOldSupport = isset($enableOldSupport);
     }
 
     /**
diff --git a/src/View/Components/Form/InputColor.php b/src/View/Components/Form/InputColor.php
index 44e70688..7ddee19c 100644
--- a/src/View/Components/Form/InputColor.php
+++ b/src/View/Components/Form/InputColor.php
@@ -4,6 +4,8 @@
 
 class InputColor extends InputGroupComponent
 {
+    use Traits\OldValueSupportTrait;
+
     /**
      * The Bootstrap Colorpicker plugin configuration parameters. Array with
      * key => value pairs, where the key should be an existing configuration
@@ -22,7 +24,7 @@ class InputColor extends InputGroupComponent
     public function __construct(
         $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
         $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
-        $errorKey = null, $config = []
+        $errorKey = null, $config = [], $enableOldSupport = null
     ) {
         parent::__construct(
             $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
@@ -30,6 +32,7 @@ public function __construct(
         );
 
         $this->config = is_array($config) ? $config : [];
+        $this->enableOldSupport = isset($enableOldSupport);
     }
 
     /**
diff --git a/src/View/Components/Form/InputSlider.php b/src/View/Components/Form/InputSlider.php
index c0020964..d125ed9b 100644
--- a/src/View/Components/Form/InputSlider.php
+++ b/src/View/Components/Form/InputSlider.php
@@ -4,6 +4,8 @@
 
 class InputSlider extends InputGroupComponent
 {
+    use Traits\OldValueSupportTrait;
+
     /**
      * The bootstrap-slider plugin configuration parameters. Array with
      * key => value pairs, where the key should be an existing configuration
@@ -29,7 +31,7 @@ class InputSlider extends InputGroupComponent
     public function __construct(
         $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
         $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
-        $errorKey = null, $config = [], $color = null
+        $errorKey = null, $config = [], $color = null, $enableOldSupport = null
     ) {
         parent::__construct(
             $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
@@ -37,6 +39,7 @@ public function __construct(
         );
 
         $this->config = is_array($config) ? $config : [];
+        $this->enableOldSupport = isset($enableOldSupport);
         $this->color = $color;
 
         // Set a default plugin 'id' option.
diff --git a/src/View/Components/Form/InputSwitch.php b/src/View/Components/Form/InputSwitch.php
index 249c9543..10ab2285 100644
--- a/src/View/Components/Form/InputSwitch.php
+++ b/src/View/Components/Form/InputSwitch.php
@@ -4,6 +4,8 @@
 
 class InputSwitch extends InputGroupComponent
 {
+    use Traits\OldValueSupportTrait;
+
     /**
      * The Bootstrap Switch plugin configuration parameters. Array with
      * key => value pairs, where the key should be an existing configuration
@@ -22,7 +24,7 @@ class InputSwitch extends InputGroupComponent
     public function __construct(
         $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
         $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
-        $errorKey = null, $config = []
+        $errorKey = null, $config = [], $enableOldSupport = null
     ) {
         parent::__construct(
             $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
@@ -30,6 +32,7 @@ public function __construct(
         );
 
         $this->config = is_array($config) ? $config : [];
+        $this->enableOldSupport = isset($enableOldSupport);
     }
 
     /**
diff --git a/src/View/Components/Form/SelectBs.php b/src/View/Components/Form/SelectBs.php
index 6ecc0bdd..c64b7ff4 100644
--- a/src/View/Components/Form/SelectBs.php
+++ b/src/View/Components/Form/SelectBs.php
@@ -4,6 +4,8 @@
 
 class SelectBs extends InputGroupComponent
 {
+    use Traits\OldValueSupportTrait;
+
     /**
      * The bootstrap-select plugin configuration parameters. Array with
      * key => value pairs, where the key should be an existing configuration
@@ -22,7 +24,7 @@ class SelectBs extends InputGroupComponent
     public function __construct(
         $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
         $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
-        $errorKey = null, $config = []
+        $errorKey = null, $config = [], $enableOldSupport = null
     ) {
         parent::__construct(
             $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
@@ -30,6 +32,7 @@ public function __construct(
         );
 
         $this->config = is_array($config) ? $config : [];
+        $this->enableOldSupport = isset($enableOldSupport);
     }
 
     /**
diff --git a/src/View/Components/Form/TextEditor.php b/src/View/Components/Form/TextEditor.php
index 83d8a0da..f52a0e94 100644
--- a/src/View/Components/Form/TextEditor.php
+++ b/src/View/Components/Form/TextEditor.php
@@ -4,6 +4,8 @@
 
 class TextEditor extends InputGroupComponent
 {
+    use Traits\OldValueSupportTrait;
+
     /**
      * The Summernote plugin configuration parameters. Array with key => value
      * pairs, where the key should be an existing configuration property of
@@ -23,7 +25,7 @@ class TextEditor extends InputGroupComponent
     public function __construct(
         $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
         $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
-        $errorKey = null, $config = []
+        $errorKey = null, $config = [], $enableOldSupport = null
     ) {
         parent::__construct(
             $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
@@ -31,6 +33,7 @@ public function __construct(
         );
 
         $this->config = is_array($config) ? $config : [];
+        $this->enableOldSupport = isset($enableOldSupport);
 
         // Setup the default plugin width option.
 


Test patch:
diff --git a/tests/Components/FormComponentsTest.php b/tests/Components/FormComponentsTest.php
index 8c61a907..eecb26fd 100644
--- a/tests/Components/FormComponentsTest.php
+++ b/tests/Components/FormComponentsTest.php
@@ -7,6 +7,8 @@ class FormComponentsTest extends TestCase
 {
     /**
      * Return array with the available blade components.
+     *
+     * @return array
      */
     protected function getComponents()
     {
@@ -33,6 +35,9 @@ protected function getComponents()
 
     /**
      * Add an error on the session's error bag for the provided $key.
+     *
+     * @param  string  $key  The key for which to add an error
+     * @return void
      */
     protected function addErrorOnSessionFor($key)
     {
@@ -46,6 +51,7 @@ protected function addErrorOnSessionFor($key)
      *
      * @param  string  $key  The input key
      * @param  mixed  $val  The input value
+     * @return void
      */
     protected function addInputOnCurrentRequest($key, $val)
     {
@@ -69,7 +75,7 @@ public function testAllComponentsRender()
 
     /*
     |--------------------------------------------------------------------------
-    | Individual form components tests.
+    | Input group component tests.
     |--------------------------------------------------------------------------
     */
 
@@ -95,6 +101,91 @@ public function testInputGroupComponent()
         $this->assertStringContainsString('is-invalid', $iClass);
     }
 
+    /*
+    |--------------------------------------------------------------------------
+    | Date range component tests.
+    |--------------------------------------------------------------------------
+    */
+
+    public function testDateRangeComponent()
+    {
+        $component = new Components\Form\DateRange('name');
+
+        $this->addErrorOnSessionFor('name');
+
+        $iClass = $component->makeItemClass();
+
+        $this->assertStringContainsString('form-control', $iClass);
+        $this->assertStringContainsString('is-invalid', $iClass);
+    }
+
+    public function testDateRangeComponentOldSupport()
+    {
+        // Test component with old support disabled.
+
+        $component = new Components\Form\DateRange('name');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('default', $oVal);
+
+        // Test component with old support enabled.
+
+        $component = new Components\Form\DateRange(
+            'name', null, null, null, null, null, null,
+            null, null, null, null, true
+        );
+
+        $this->addInputOnCurrentRequest('name', 'foo');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('foo', $oVal);
+    }
+
+    /*
+    |--------------------------------------------------------------------------
+    | Input color component tests.
+    |--------------------------------------------------------------------------
+    */
+
+    public function testInputColorComponent()
+    {
+        $component = new Components\Form\InputColor('name');
+
+        $this->addErrorOnSessionFor('name');
+
+        $iClass = $component->makeItemClass();
+
+        $this->assertStringContainsString('form-control', $iClass);
+        $this->assertStringContainsString('is-invalid', $iClass);
+    }
+
+    public function testInputColorComponentOldSupport()
+    {
+        // Test component with old support disabled.
+
+        $component = new Components\Form\InputColor('name');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('default', $oVal);
+
+        // Test component with old support enabled.
+
+        $component = new Components\Form\InputColor(
+            'name', null, null, null, null, null, null, null, null, null, true
+        );
+
+        $this->addInputOnCurrentRequest('name', 'foo');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('foo', $oVal);
+    }
+
+    /*
+    |--------------------------------------------------------------------------
+    | Input date component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testInputDateComponent()
     {
         $component = new Components\Form\InputDate('name');
@@ -128,6 +219,12 @@ public function testInputDateComponentOldSupport()
         $this->assertEquals('foo', $oVal);
     }
 
+    /*
+    |--------------------------------------------------------------------------
+    | Input file component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testInputFileComponent()
     {
         $component = new Components\Form\InputFile('name', null, null, 'sm');
@@ -139,6 +236,12 @@ public function testInputFileComponent()
         $this->assertStringContainsString('is-invalid', $iClass);
     }
 
+    /*
+    |--------------------------------------------------------------------------
+    | Input slider component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testInputSliderComponent()
     {
         $component = new Components\Form\InputSlider(
@@ -157,6 +260,34 @@ public function testInputSliderComponent()
         $this->assertStringContainsString('is-invalid', $iClass);
     }
 
+    public function testInputSliderComponentOldSupport()
+    {
+        // Test component with old support disabled.
+
+        $component = new Components\Form\InputSlider('name');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('default', $oVal);
+
+        // Test component with old support enabled.
+
+        $component = new Components\Form\InputSlider(
+            'name', null, null, null, null, null, null,
+            null, null, null, null, true
+        );
+
+        $this->addInputOnCurrentRequest('name', 'foo');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('foo', $oVal);
+    }
+
+    /*
+    |--------------------------------------------------------------------------
+    | Input switch component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testInputSwitchComponent()
     {
         $component = new Components\Form\InputSwitch(
@@ -175,6 +306,33 @@ public function testInputSwitchComponent()
         $this->assertStringContainsString('is-invalid', $iClass);
     }
 
+    public function testInputSwitchComponentOldSupport()
+    {
+        // Test component with old support disabled.
+
+        $component = new Components\Form\InputSwitch('name');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('default', $oVal);
+
+        // Test component with old support enabled.
+
+        $component = new Components\Form\InputSwitch(
+            'name', null, null, null, null, null, null, null, null, null, true
+        );
+
+        $this->addInputOnCurrentRequest('name', 'foo');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('foo', $oVal);
+    }
+
+    /*
+    |--------------------------------------------------------------------------
+    | Options component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testOptionsComponent()
     {
         $options = ['m' => 'Male', 'f' => 'Female', 'o' => 'Other'];
@@ -233,6 +391,12 @@ public function testOptionsComponent()
         $this->assertStringMatchesFormat($format, $html);
     }
 
+    /*
+    |--------------------------------------------------------------------------
+    | Select component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testSelectComponent()
     {
         $component = new Components\Form\Select('name');
@@ -266,6 +430,12 @@ public function testSelectComponentOldSupport()
         $this->assertEquals('foo', $oVal);
     }
 
+    /*
+    |--------------------------------------------------------------------------
+    | Select2 component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testSelect2Component()
     {
         $component = new Components\Form\Select2('name');
@@ -299,6 +469,12 @@ public function testSelect2ComponentOldSupport()
         $this->assertEquals('foo', $oVal);
     }
 
+    /*
+    |--------------------------------------------------------------------------
+    | SelectBs component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testSelectBsComponent()
     {
         $component = new Components\Form\SelectBs('name', null, null, 'lg');
@@ -312,6 +488,33 @@ public function testSelectBsComponent()
         $this->assertStringContainsString('is-invalid', $iClass);
     }
 
+    public function testSelectBsComponentOldSupport()
+    {
+        // Test component with old support disabled.
+
+        $component = new Components\Form\SelectBs('name');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('default', $oVal);
+
+        // Test component with old support enabled.
+
+        $component = new Components\Form\SelectBs(
+            'name', null, null, null, null, null, null, null, null, null, true
+        );
+
+        $this->addInputOnCurrentRequest('name', 'foo');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('foo', $oVal);
+    }
+
+    /*
+    |--------------------------------------------------------------------------
+    | Text editor component tests.
+    |--------------------------------------------------------------------------
+    */
+
     public function testTextEditorComponent()
     {
         $component = new Components\Form\TextEditor(
@@ -327,4 +530,25 @@ public function testTextEditorComponent()
         $this->assertStringContainsString('igroup-class', $iGroupClass);
         $this->assertStringContainsString('adminlte-invalid-itegroup', $iGroupClass);
     }
+
+    public function testTextEditorComponentOldSupport()
+    {
+        // Test component with old support disabled.
+
+        $component = new Components\Form\TextEditor('name');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('default', $oVal);
+
+        // Test component with old support enabled.
+
+        $component = new Components\Form\TextEditor(
+            'name', null, null, null, null, null, null, null, null, null, true
+        );
+
+        $this->addInputOnCurrentRequest('name', 'foo');
+        $oVal = $component->getOldValue('name', 'default');
+
+        $this->assertEquals('foo', $oVal);
+    }
 }