Skip to content

Commit

Permalink
feat: Nicer error message on reply form with auto expand on error. (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
wadedvsa authored Mar 5, 2024
1 parent b3cd448 commit fa70b35
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
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
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
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

0 comments on commit fa70b35

Please sign in to comment.