feat: FORMS-25252 add server-side validation (SSV)#1902
Conversation
Accessibility Violations Found
|
10d09e8 to
3d10aa4
Compare
Accessibility Violations Found
|
Accessibility Violations Found
|
2 similar comments
Accessibility Violations Found
|
Accessibility Violations Found
|
| submitProps.computeIfAbsent(SS_SPREADSHEET, k -> new LinkedHashMap<String, Object>()); | ||
| ((Map<String, Object>) submitProps.get(SS_SPREADSHEET)).put(entry.getKey(), entry.getValue()); | ||
| } | ||
| // SSV properties (enableServerSideValidation, ssvCloudServicePath) are intentionally |
There was a problem hiding this comment.
nitpick: comment not required here
| granite:class="cmp-adaptiveform-container__enablessv" | ||
| name="./enableServerSideValidation" | ||
| text="Enable Server-Side Validation" | ||
| value="true" |
There was a problem hiding this comment.
I think default value should be false
There was a problem hiding this comment.
Yes made it false.
Accessibility Violations Found
|
1 similar comment
Accessibility Violations Found
|
| public static final String PN_SUBMIT_EMAIL_CC = "cc"; | ||
| public static final String PN_SUBMIT_EMAIL_BCC = "bcc"; | ||
| public static final String PN_SUBMIT_SPREADSHEETURL = "spreadsheetUrl"; | ||
| public static final String PN_ENABLE_SERVER_SIDE_VALIDATION = "enableServerSideValidation"; |
There was a problem hiding this comment.
all OOTB properties should be prefixed with fd:
There was a problem hiding this comment.
These properties should not be part of the model.json output since they are server side, there can be a use-case for EDS submit, that can be handled later
There was a problem hiding this comment.
These are not part of model.json; these are just for internal code use.
| </cui> | ||
| </uiSettings> | ||
| </thankYouMessage> | ||
| <enableServerSideValidation |
There was a problem hiding this comment.
This should be hidden and only enabled if someone selects enable server side validation
There was a problem hiding this comment.
Discussed with Anurag and Sudhanshu that, in order to improve the archaic behaviour, we should keep only one dropdown with a default value of None.
| jcr:primaryType="nt:unstructured" | ||
| sling:resourceType="granite/ui/components/coral/foundation/form/checkbox" | ||
| fieldLabel="Server-Side Validation" | ||
| fieldDescription="Call an Adobe I/O validator endpoint before the submit action runs." |
There was a problem hiding this comment.
We need to have help article for users to understand how to create one
There was a problem hiding this comment.
Yes I will be creating a Doc for the customer.
| let defaultSubmissionError = FormView.LanguageUtils.getTranslatedString(self.getLang(), "InternalFormSubmissionError"); | ||
| const globals = { | ||
| form: self.getModel().getRuleNode(), | ||
| formModel: self.getModel(), |
| <enableServerSideValidation | ||
| jcr:primaryType="nt:unstructured" | ||
| sling:resourceType="granite/ui/components/coral/foundation/form/checkbox" | ||
| fieldLabel="Server-Side Validation" |
There was a problem hiding this comment.
Can we create a github clone so that users can refer that as sample to deploy Adobe IO action ? I want to make sure that they dont spend a lot of time doing this
There was a problem hiding this comment.
Yes, I will be creating one.
…container - Add enableServerSideValidation checkbox and ssvCloudServicePath cloud service picker to the form container edit dialog (Submission tab) - SSV config path picker shown/hidden based on checkbox state (editDialog.js) - Read enableServerSideValidation and ssvCloudServicePath from JCR in AdaptiveFormSubmitServlet; call Adobe I/O endpoint before submit action runs - On SSV failure respond HTTP 400 with SSV_VALIDATION_ERROR body and x-aem-error-pass header so the client can show inline field errors - Expose formModel on globals in formcontainerview.js so defaultSubmitErrorHandler can call visit() / markAsInvalid() without proxy restrictions - Implement SSV-aware defaultSubmitErrorHandler in customFunctions.js; delegates to cf.defaultSubmitErrorHandler for non-SSV failures - Guard ssvCloudServicePath from being exported to form JSON (security) - Add ReservedProperties constants for both new JCR property names - Add FormContainerImplTest assertions verifying SSV props are excluded from JSON - Add Jest tests for SSV error handler logic
field.id is the stable JCR-path-based identifier; field.name is the author-assigned name. Either can be returned by the IO Runtime action depending on how the action was written, so check both.
- Dialog: add @typehint=Boolean hidden field for enableServerSideValidation so Sling POST stores it as JCR Boolean, not String (B2a) - editDialog.js: replace bare visibility toggle with updateSsvVisibility() that calls manageDeleteFields — clears value, marks ssvCloudServicePath not-required, and adds @delete when checkbox is unchecked; reverses on re-check so stale JCR paths are not left behind (B3) - customFunctions.js: log console.warn when an SSV fieldName has no matching field in the form, so developers can diagnose name mismatches instead of errors silently disappearing (I4)
…container - Add enableServerSideValidation checkbox and ssvCloudServicePath cloud service picker to the form container edit dialog (Submission tab) - SSV config path picker shown/hidden based on checkbox state (editDialog.js) - Read enableServerSideValidation and ssvCloudServicePath from JCR in AdaptiveFormSubmitServlet; call Adobe I/O endpoint before submit action runs - On SSV failure respond HTTP 400 with SSV_VALIDATION_ERROR body and x-aem-error-pass header so the client can show inline field errors - Expose formModel on globals in formcontainerview.js so defaultSubmitErrorHandler can call visit() / markAsInvalid() without proxy restrictions - Implement SSV-aware defaultSubmitErrorHandler in customFunctions.js; delegates to cf.defaultSubmitErrorHandler for non-SSV failures - Guard ssvCloudServicePath from being exported to form JSON (security) - Add ReservedProperties constants for both new JCR property names - Add FormContainerImplTest assertions verifying SSV props are excluded from JSON - Add Jest tests for SSV error handler logic
field.id is the stable JCR-path-based identifier; field.name is the author-assigned name. Either can be returned by the IO Runtime action depending on how the action was written, so check both.
- Dialog: add @typehint=Boolean hidden field for enableServerSideValidation so Sling POST stores it as JCR Boolean, not String (B2a) - editDialog.js: replace bare visibility toggle with updateSsvVisibility() that calls manageDeleteFields — clears value, marks ssvCloudServicePath not-required, and adds @delete when checkbox is unchecked; reverses on re-check so stale JCR paths are not left behind (B3) - customFunctions.js: log console.warn when an SSV fieldName has no matching field in the form, so developers can diagnose name mismatches instead of errors silently disappearing (I4)
7b1c652 to
665f05d
Compare
Accessibility Violations Found
|
Accessibility Violations Found
|
Accessibility Violations Found
|
1 similar comment
Accessibility Violations Found
|
Accessibility Violations Found
|
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: