Skip to content

feat: FORMS-25252 add server-side validation (SSV)#1902

Merged
rajatofficial merged 3 commits into
devfrom
feat/FORMS-25252-server-side-validation
Jun 24, 2026
Merged

feat: FORMS-25252 add server-side validation (SSV)#1902
rajatofficial merged 3 commits into
devfrom
feat/FORMS-25252-server-side-validation

Conversation

@rajatofficial

Copy link
Copy Markdown
Contributor
  • 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

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@github-actions github-actions Bot force-pushed the feat/FORMS-25252-server-side-validation branch from 10d09e8 to 3d10aa4 Compare June 11, 2026 12:35
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

@rajatofficial rajatofficial changed the title feat(af-core): FORMS-25252 add server-side validation (SSV) feat: FORMS-25252 add server-side validation (SSV) Jun 11, 2026
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

2 similar comments
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: comment not required here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

granite:class="cmp-adaptiveform-container__enablessv"
name="./enableServerSideValidation"
text="Enable Server-Side Validation"
value="true"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think default value should be false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes made it false.

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

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";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all OOTB properties should be prefixed with fd:

@rismehta rismehta Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not part of model.json; these are just for internal code use.

</cui>
</uiSettings>
</thankYouMessage>
<enableServerSideValidation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be hidden and only enabled if someone selects enable server side validation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to have help article for users to understand how to create one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this required ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not required. Removed it.

<enableServerSideValidation
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
fieldLabel="Server-Side Validation"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will be creating one.

@rismehta rismehta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check comments

@rismehta rismehta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check comments

@rajatofficial rajatofficial force-pushed the feat/FORMS-25252-server-side-validation branch from 7b1c652 to 665f05d Compare June 16, 2026 05:02
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@github-actions github-actions Bot force-pushed the feat/FORMS-25252-server-side-validation branch from b0589ab to e397c06 Compare June 18, 2026 13:20
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

3 similar comments
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 7.31707% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ternal/servlets/FormMetaDataDataSourceServlet.java 7.31% 37 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@rajatofficial rajatofficial force-pushed the feat/FORMS-25252-server-side-validation branch from 0068aba to a69124c Compare June 23, 2026 06:29
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

}

private List<Resource> getCloudConfigsByGroup(SlingHttpServletRequest request, ResourceResolver resourceResolver) {
List<Resource> resources = new ArrayList<>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, we have helpers in cq-guides (addon) for such use-cases, you should re-use that

@rismehta rismehta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. but there are few unresolved comments, address them later

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

@rajatofficial rajatofficial force-pushed the feat/FORMS-25252-server-side-validation branch from 60d88c2 to 45900ec Compare June 24, 2026 09:44
@github-actions github-actions Bot force-pushed the feat/FORMS-25252-server-side-validation branch from 45900ec to b86b3ea Compare June 24, 2026 09:44
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

3 similar comments
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@rajatofficial rajatofficial merged commit d8872b5 into dev Jun 24, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants