You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2019/07/25 19:19:26 UTC

[sling-org-apache-sling-app-cms] 02/03: Adding a class configuration for the alert

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch dklco/form-framework
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 87d298d6a3ed5ffcb7ddf7f08cef6f251febcbec
Author: Dan Klco <dk...@apache.org>
AuthorDate: Thu Jul 25 14:52:13 2019 -0400

    Adding a class configuration for the alert
---
 .../apps/reference/components/forms/form/config.json         |  7 +++++++
 .../jcr_root/apps/reference/components/forms/form/form.jsp   | 12 +++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/config.json
index 18de6cb..9644259 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/config.json
@@ -15,6 +15,13 @@
         "name": "submitClass",
         "type": "text"
     },
+    "alertClass": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "sling-cms/components/editor/fields/text",
+        "label": "Alert Class",
+        "name": "alertClass",
+        "type": "text"
+    },
     "fieldClass": {
         "jcr:primaryType": "nt:unstructured",
         "sling:resourceType": "sling-cms/components/editor/fields/text",
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/form.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/form.jsp
index dc55367..c997126 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/form.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/forms/form/form.jsp
@@ -21,13 +21,19 @@
 <c:set var="formData" value="${sling:adaptTo(slingRequest,'org.apache.sling.cms.reference.forms.FormRequest').formData}" scope="request" />
 <form class="${formConfig.formClass}" action="${resource.path}.allowpost.html" method="post" data-analytics-id="${sling:encode(properties.formId,'HTML_ATTR')}">
     <c:if test="${param.message == 'success'}">
-        ${properties.successMessage}
+        <div class="${formConfig.alertClass}">
+            ${properties.successMessage}
+        </div>
     </c:if>
     <c:if test="${param.error == 'actions'}">
-        ${properties.actionsErrorMessage}
+        <div class="${formConfig.alertClass}">
+            ${properties.actionsErrorMessage}
+        </div>
     </c:if>
     <c:if test="${param.error == 'fields'}">
-        ${properties.fieldsErrorMessage}
+        <div class="${formConfig.alertClass}">
+            ${properties.fieldsErrorMessage}
+        </div>
     </c:if>
 
     <c:set var="oldAvailableTypes" value="${availableTypes}" />