From 50c2fa3e3d096474e9f8a622e29bb38d4590b284 Mon Sep 17 00:00:00 2001 From: sc-illiakovalenko Date: Wed, 17 Jun 2020 14:00:34 +0300 Subject: [PATCH] [JSS][Forms] Assign Sitecore.Context.Item in Forms submit actions on a JSS Forms submit --- packages/sitecore-jss-forms/src/SitecoreForm.ts | 1 + packages/sitecore-jss-react-forms/src/components/form.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sitecore-jss-forms/src/SitecoreForm.ts b/packages/sitecore-jss-forms/src/SitecoreForm.ts index c03630a633..d13fd8d308 100644 --- a/packages/sitecore-jss-forms/src/SitecoreForm.ts +++ b/packages/sitecore-jss-forms/src/SitecoreForm.ts @@ -5,6 +5,7 @@ import { HtmlFormField } from './HtmlFormField'; /** The model returned from the Sitecore Forms JSON API for a form schema */ export interface SitecoreForm { htmlPrefix: string; + contextItemId: string; formSessionId: HtmlFormField; formItemId: HtmlFormField; pageItemId: HtmlFormField; diff --git a/packages/sitecore-jss-react-forms/src/components/form.tsx b/packages/sitecore-jss-react-forms/src/components/form.tsx index c4f1cdb03d..8440467954 100644 --- a/packages/sitecore-jss-react-forms/src/components/form.tsx +++ b/packages/sitecore-jss-react-forms/src/components/form.tsx @@ -95,7 +95,7 @@ export class Form extends Component return (
Form data invalid. Forget to set the rendering contents resolver?
); } - const action = `${this.props.sitecoreApiHost}/api/jss/formbuilder?fxb.FormItemId=${form.metadata.itemId}&fxb.HtmlPrefix=${form.htmlPrefix}&sc_apikey=${this.props.sitecoreApiKey}`; + const action = `${this.props.sitecoreApiHost}/api/jss/formbuilder?fxb.FormItemId=${form.metadata.itemId}&fxb.HtmlPrefix=${form.htmlPrefix}&sc_apikey=${this.props.sitecoreApiKey}&sc_itemid=${form.contextItemId}`; this._tracker.setFormData(form.formItemId.value, form.formSessionId.value, form.metadata.isTrackingEnabled);