Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

feat: Nicer error message on reply form with auto expand on error. #103

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
5 changes: 4 additions & 1 deletion module/Olcs/src/Form/Model/Fieldset/LicenceMessageReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion module/Olcs/view/pages/conversation/messages.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<?php if ($this->placeholder('can-reply')->getValue()): ?>
<details class="govuk-details" data-module="govuk-details">
<details class="govuk-details" data-module="govuk-details"<?php if ($this->placeholder('open-reply')->getValue()): ?> open<?php endif; ?>>
<summary class="govuk-details__summary" aria-controls="details-content-operating-centre">
<span class="govuk-details__summary-text">
Send a reply
Expand Down
Loading