From 77a139016b73f6c3b046ca6fc96176aba62d14f3 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 17 Jan 2025 18:09:25 +1100 Subject: [PATCH] Fix when cloning an attribute, ensure we blank out the previous value. When processing request submission '0' could be a valid value. --- app/Http/Controllers/HomeController.php | 2 +- resources/views/components/attribute/widget/options.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 024cc1b..53a9331 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -123,7 +123,7 @@ class HomeController extends Controller $o = config('server')->fetch($dn); foreach ($request->except(['_token','dn','userpassword_hash','userpassword']) as $key => $value) - $o->{$key} = array_filter($value); + $o->{$key} = array_filter($value,fn($item)=>! is_null($item)); // We need to process and encrypt the password $passwords = []; diff --git a/resources/views/components/attribute/widget/options.blade.php b/resources/views/components/attribute/widget/options.blade.php index 067a0d8..59d31a5 100644 --- a/resources/views/components/attribute/widget/options.blade.php +++ b/resources/views/components/attribute/widget/options.blade.php @@ -13,7 +13,7 @@ // Create a new entry when Add Value clicked $('#{{ $o->name_lc }}.addable').click(function (item) { var cln = $(this).parent().parent().find('input:last').clone(); - cln.val('').attr('placeholder', '[@lang('NEW')]'); + cln.attr('value','').attr('placeholder', '[@lang('NEW')]'); cln.appendTo('#' + item.currentTarget.id) }); });