From fa70b35c65ef6a3d14bd74df2126ae7a31171a38 Mon Sep 17 00:00:00 2001 From: Wade Womersley <155439365+wadedvsa@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:09:19 +0000 Subject: [PATCH] feat: Nicer error message on reply form with auto expand on error. (dvsa/olcs-internal#103) --- .../Messages/AbstractConversationMessagesController.php | 1 + .../Olcs/src/Form/Model/Fieldset/LicenceMessageReply.php | 5 ++++- .../module/Olcs/view/pages/conversation/messages.phtml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/internal/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php b/app/internal/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php index 60f8fa8152..86ff22ec0f 100644 --- a/app/internal/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php +++ b/app/internal/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php @@ -113,6 +113,7 @@ protected function parseReply(Form $form) $form->get('id')->setValue($this->params()->fromRoute('conversation')); if (!$form->isValid()) { + $this->placeholder()->setPlaceholder('open-reply', true); return parent::indexAction(); } diff --git a/app/internal/module/Olcs/src/Form/Model/Fieldset/LicenceMessageReply.php b/app/internal/module/Olcs/src/Form/Model/Fieldset/LicenceMessageReply.php index fe4a8e613c..c7f8862492 100644 --- a/app/internal/module/Olcs/src/Form/Model/Fieldset/LicenceMessageReply.php +++ b/app/internal/module/Olcs/src/Form/Model/Fieldset/LicenceMessageReply.php @@ -16,7 +16,10 @@ class LicenceMessageReply * "class": "extra-long", * "maxlength": 1000 * }) - * @Form\Options({"label": "You can enter up to 1000 characters"}) + * @Form\Options({ + * "label": "You can enter up to 1000 characters", + * "error-message": "Value is required and must be between 5 and 1000 characters." + * }) * @Form\Required(true) * @Form\Type(\Laminas\Form\Element\Textarea::class) * @Form\Filter(\Laminas\Filter\StringTrim::class) diff --git a/app/internal/module/Olcs/view/pages/conversation/messages.phtml b/app/internal/module/Olcs/view/pages/conversation/messages.phtml index 061746c357..e0d2027c13 100644 --- a/app/internal/module/Olcs/view/pages/conversation/messages.phtml +++ b/app/internal/module/Olcs/view/pages/conversation/messages.phtml @@ -14,7 +14,7 @@ placeholder('can-reply')->getValue()): ?> -
+
placeholder('open-reply')->getValue()): ?> open> Send a reply