From d3c7bfcf794ec24b54e7ec6d69ca33b722e9b716 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 22 Jun 2025 09:40:45 +1000 Subject: [PATCH] Ensure form validation is displayed on template input entries, especially those marked as read-only --- .../views/components/attribute.blade.php | 21 +++++++++---------- resources/views/frames/create.blade.php | 4 ++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/views/components/attribute.blade.php b/resources/views/components/attribute.blade.php index 435f675b..373b7b5f 100644 --- a/resources/views/components/attribute.blade.php +++ b/resources/views/components/attribute.blade.php @@ -5,20 +5,19 @@ @foreach($o->langtags as $langtag) $loop->index === 0]) id="langtag-{{ $o->name_lc }}-{{ $langtag }}" role="tabpanel"> @foreach(Arr::get(old($o->name_lc,[$langtag=>$new ? [NULL] : $o->tagValues($langtag)]),$langtag,[]) as $key => $value) - @if($edit && (! $o->is_rdn)) -
+
+ @if($edit && (! $o->is_rdn)) ($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! ($tv=$o->tagValuesOld($langtag))->contains($value),'bg-success-subtle'=>$updated]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ $value }}" placeholder="{{ ! is_null($x=$tv->get($loop->index)) ? $x : '['.__('NEW').']' }}" @readonly(! $new) @disabled($o->isDynamic())> + @else + ($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','bg-success-subtle'=>$updated]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ $value }}" readonly> + @endif -
- @if($e) - {{ join('|',$e) }} - @endif -
+
+ @if($e) + {{ join('|',$e) }} + @endif
- - @else - $updated]) value="{{ $value }}" disabled> - @endif +
@endforeach @endforeach diff --git a/resources/views/frames/create.blade.php b/resources/views/frames/create.blade.php index aedd76af..95289080 100644 --- a/resources/views/frames/create.blade.php +++ b/resources/views/frames/create.blade.php @@ -106,6 +106,10 @@ if (rdn_attr && ($(this)[0].name === rdn_attr+'[]')) return; + // Exclude attributes marked as noedit + if ($(this).hasClass('noedit')) + return; + $(this).attr('readonly',false); });