diff --git a/lib/form/templatable_form_element.php b/lib/form/templatable_form_element.php index e0b235a22e8..447a822c918 100644 --- a/lib/form/templatable_form_element.php +++ b/lib/form/templatable_form_element.php @@ -82,6 +82,7 @@ trait templatable_form_element { $context['type'] = $this->getType(); $context['attributes'] = implode(' ', $otherattributes); $context['emptylabel'] = ($this->getLabel() === ''); + $context['iderror'] = preg_replace('/^id_/', 'id_error_', $context['id']); // Elements with multiple values need array syntax. if ($this->getAttribute('multiple')) { diff --git a/lib/form/templates/element-advcheckbox-inline.mustache b/lib/form/templates/element-advcheckbox-inline.mustache index 94d2fd6f044..0584acc05d6 100644 --- a/lib/form/templates/element-advcheckbox-inline.mustache +++ b/lib/form/templates/element-advcheckbox-inline.mustache @@ -15,7 +15,7 @@ {{#element.checked}}checked{{/element.checked}} size="{{element.size}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{#element.frozen}} disabled @@ -27,7 +27,7 @@ {{{.}}} {{/text}} {{{helpbutton}}} - + {{{error}}} {{^element.frozen}} diff --git a/lib/form/templates/element-advcheckbox.mustache b/lib/form/templates/element-advcheckbox.mustache index 8e1a472119f..e775939fb55 100644 --- a/lib/form/templates/element-advcheckbox.mustache +++ b/lib/form/templates/element-advcheckbox.mustache @@ -25,7 +25,7 @@ {{/element.selectedvalue}} id="{{element.id}}" {{#element.checked}}checked{{/element.checked}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{#element.frozen}} disabled @@ -43,7 +43,7 @@ {{{helpbutton}}} -
+
{{{error}}}
diff --git a/lib/form/templates/element-autocomplete-inline.mustache b/lib/form/templates/element-autocomplete-inline.mustache index 175280ea15b..127fa775326 100644 --- a/lib/form/templates/element-autocomplete-inline.mustache +++ b/lib/form/templates/element-autocomplete-inline.mustache @@ -8,7 +8,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-autocomplete.mustache b/lib/form/templates/element-autocomplete.mustache index 8736f0a720a..ead064d6eb8 100644 --- a/lib/form/templates/element-autocomplete.mustache +++ b/lib/form/templates/element-autocomplete.mustache @@ -8,7 +8,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-button-inline.mustache b/lib/form/templates/element-button-inline.mustache index fff81f93191..3806649ae43 100644 --- a/lib/form/templates/element-button-inline.mustache +++ b/lib/form/templates/element-button-inline.mustache @@ -7,7 +7,7 @@ id="{{element.id}}" type="button" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > diff --git a/lib/form/templates/element-button.mustache b/lib/form/templates/element-button.mustache index 3ce46e2b35b..c3e29cdfb06 100644 --- a/lib/form/templates/element-button.mustache +++ b/lib/form/templates/element-button.mustache @@ -7,7 +7,7 @@ id="{{element.id}}" type="button" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}}> {{{element.value}}} diff --git a/lib/form/templates/element-checkbox-inline.mustache b/lib/form/templates/element-checkbox-inline.mustache index 279affb4137..994ebc5a786 100644 --- a/lib/form/templates/element-checkbox-inline.mustache +++ b/lib/form/templates/element-checkbox-inline.mustache @@ -15,7 +15,7 @@ {{#element.checked}}checked{{/element.checked}} size="{{element.size}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{#element.frozen}} disabled @@ -27,7 +27,7 @@ {{{.}}} {{/text}} {{{helpbutton}}} - + {{{error}}} {{^element.frozen}} diff --git a/lib/form/templates/element-checkbox.mustache b/lib/form/templates/element-checkbox.mustache index 9277f0b79d1..785290533ee 100644 --- a/lib/form/templates/element-checkbox.mustache +++ b/lib/form/templates/element-checkbox.mustache @@ -25,7 +25,7 @@ {{/element.value}} id="{{element.id}}" {{#element.checked}}checked{{/element.checked}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{#element.frozen}} disabled @@ -43,7 +43,7 @@ {{{helpbutton}}} -
+
{{{error}}}
diff --git a/lib/form/templates/element-password.mustache b/lib/form/templates/element-password.mustache index 09f779f2bb7..fdd5cdb2138 100644 --- a/lib/form/templates/element-password.mustache +++ b/lib/form/templates/element-password.mustache @@ -8,7 +8,7 @@ value="{{element.value}}" size="{{element.size}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}}> {{/element.frozen}} {{/element}} diff --git a/lib/form/templates/element-passwordunmask.mustache b/lib/form/templates/element-passwordunmask.mustache index 2fa7e5f2080..999ee728d61 100644 --- a/lib/form/templates/element-passwordunmask.mustache +++ b/lib/form/templates/element-passwordunmask.mustache @@ -57,7 +57,7 @@ class="form-control d-inline-block {{# error }}is-invalid{{/ error }}" data-size="{{ element.size }}" {{# error }} - autofocus aria-describedby="id_error_{{ element.name }}" + autofocus aria-describedby="{{ element.iderror }}" {{/ error }} {{{ attributes }}} > diff --git a/lib/form/templates/element-radio-inline.mustache b/lib/form/templates/element-radio-inline.mustache index bac7a26d627..7f99a2ec840 100644 --- a/lib/form/templates/element-radio-inline.mustache +++ b/lib/form/templates/element-radio-inline.mustache @@ -19,7 +19,7 @@ {{#element.checked}}checked{{/element.checked}} {{#element.frozen}}disabled{{/element.frozen}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{{label}}} @@ -28,7 +28,7 @@ {{{.}}} {{/text}} {{{helpbutton}}} - + {{{error}}} {{^element.frozen}} diff --git a/lib/form/templates/element-radio.mustache b/lib/form/templates/element-radio.mustache index 87b0472c4a9..b052bda35a0 100644 --- a/lib/form/templates/element-radio.mustache +++ b/lib/form/templates/element-radio.mustache @@ -30,7 +30,7 @@ {{#element.checked}}checked{{/element.checked}} {{#element.frozen}}disabled{{/element.frozen}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#text}} {{{.}}} @@ -44,7 +44,7 @@ {{{helpbutton}}} -
+
{{{error}}}
diff --git a/lib/form/templates/element-select-inline.mustache b/lib/form/templates/element-select-inline.mustache index bd5ae84fb1d..1dcb34fd0dd 100644 --- a/lib/form/templates/element-select-inline.mustache +++ b/lib/form/templates/element-select-inline.mustache @@ -11,7 +11,7 @@ id="{{element.id}}" {{#element.multiple}}multiple size="{{element.size}}"{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-select.mustache b/lib/form/templates/element-select.mustache index 49664083597..f701053acab 100644 --- a/lib/form/templates/element-select.mustache +++ b/lib/form/templates/element-select.mustache @@ -104,7 +104,7 @@ id="{{element.id}}" {{#element.multiple}}multiple size="{{element.size}}"{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-selectgroups-inline.mustache b/lib/form/templates/element-selectgroups-inline.mustache index 1fbb0c1278a..0164335aafe 100644 --- a/lib/form/templates/element-selectgroups-inline.mustache +++ b/lib/form/templates/element-selectgroups-inline.mustache @@ -5,7 +5,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.optiongroups}} diff --git a/lib/form/templates/element-selectgroups.mustache b/lib/form/templates/element-selectgroups.mustache index 783f028bc96..15738f722b8 100644 --- a/lib/form/templates/element-selectgroups.mustache +++ b/lib/form/templates/element-selectgroups.mustache @@ -5,7 +5,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.optiongroups}} diff --git a/lib/form/templates/element-selectwithlink.mustache b/lib/form/templates/element-selectwithlink.mustache index a0bf6d0dc56..b49e0a5154b 100644 --- a/lib/form/templates/element-selectwithlink.mustache +++ b/lib/form/templates/element-selectwithlink.mustache @@ -5,7 +5,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-submit.mustache b/lib/form/templates/element-submit.mustache index cd8b8facb77..058e414a785 100644 --- a/lib/form/templates/element-submit.mustache +++ b/lib/form/templates/element-submit.mustache @@ -13,7 +13,7 @@ name="{{element.name}}" id="{{element.id}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} value="{{element.value}}" {{{element.attributes}}} > diff --git a/lib/form/templates/element-tags-inline.mustache b/lib/form/templates/element-tags-inline.mustache index e3887423bd9..eb12f780468 100644 --- a/lib/form/templates/element-tags-inline.mustache +++ b/lib/form/templates/element-tags-inline.mustache @@ -6,7 +6,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-tags.mustache b/lib/form/templates/element-tags.mustache index 0d95b4ca1b0..ea48fef60f7 100644 --- a/lib/form/templates/element-tags.mustache +++ b/lib/form/templates/element-tags.mustache @@ -6,7 +6,7 @@ id="{{element.id}}" {{#element.multiple}}multiple{{/element.multiple}} {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{#element.options}} diff --git a/lib/form/templates/element-template-inline.mustache b/lib/form/templates/element-template-inline.mustache index 98ec035ae8f..d445e4858c2 100644 --- a/lib/form/templates/element-template-inline.mustache +++ b/lib/form/templates/element-template-inline.mustache @@ -9,7 +9,7 @@ {{/ element }} -
+
{{{error}}}
diff --git a/lib/form/templates/element-template.mustache b/lib/form/templates/element-template.mustache index 80b7e0834ec..6ad5489a041 100644 --- a/lib/form/templates/element-template.mustache +++ b/lib/form/templates/element-template.mustache @@ -64,7 +64,7 @@ {{$ element }} {{/ element }} -
+
{{{error}}}
diff --git a/lib/form/templates/element-text-inline.mustache b/lib/form/templates/element-text-inline.mustache index 82350086f0d..b6bb3e91481 100644 --- a/lib/form/templates/element-text-inline.mustache +++ b/lib/form/templates/element-text-inline.mustache @@ -10,7 +10,7 @@ value="{{element.value}}" size="{{element.size}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}}> {{/element}} diff --git a/lib/form/templates/element-text.mustache b/lib/form/templates/element-text.mustache index 5cc4067e5a2..087201a6085 100644 --- a/lib/form/templates/element-text.mustache +++ b/lib/form/templates/element-text.mustache @@ -10,7 +10,7 @@ value="{{element.value}}" size="{{element.size}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} > {{/element}} diff --git a/lib/form/templates/element-textarea.mustache b/lib/form/templates/element-textarea.mustache index 10ede773fde..7b7750ef637 100644 --- a/lib/form/templates/element-textarea.mustache +++ b/lib/form/templates/element-textarea.mustache @@ -6,7 +6,7 @@ id="{{element.id}}" class="form-control {{#error}}is-invalid{{/error}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{{element.attributes}}} >{{element.value}} {{/element.frozen}} diff --git a/lib/form/templates/element-url.mustache b/lib/form/templates/element-url.mustache index b18df79ea66..5529d4a24ba 100644 --- a/lib/form/templates/element-url.mustache +++ b/lib/form/templates/element-url.mustache @@ -10,7 +10,7 @@ value="{{element.value}}" size="{{element.size}}" {{#error}} - autofocus aria-describedby="id_error_{{element.name}}" + autofocus aria-describedby="{{element.iderror}}" {{/error}} {{#element.frozen}} readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}} diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 437a1f3d814..fafc4b05d10 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -4593,8 +4593,7 @@ EOD; // The id will be something like 'fgroup_id_NAME'. E.g. fgroup_id_mygroup. $elementcontext['wrapperid'] = $elementcontext['id']; - // Ensure group elements pass through the group name as the element name so the id_error_{{element.name}} is - // properly set in the template. + // Ensure group elements pass through the group name as the element name. $elementcontext['name'] = $elementcontext['groupname']; } else { // Non grouped element.