1

Sitecore Forms field conditions are not working with JSS form package in Sitecore Version 10.2.

Does it require custom implementation?

My Code:

import { Form } from '@sitecore-jss/sitecore-jss-react-forms';
import React from 'react';
import { NextRouter, withRouter } from 'next/router';
import { sitecoreApiKey, sitecoreApiHost } from 'temp/config';

const SitecoreForms = ({ fields, router }: { fields: any; router: NextRouter }) => {
  return (
    <Form
      language={router.locale}
      form={fields}
      sitecoreApiHost={sitecoreApiHost}
      sitecoreApiKey={sitecoreApiKey}
      onRedirect={(url) => router.push(url)}
    />
  );
};

export default withRouter(SitecoreForms);

As per my condition button should visible only when checkbox is checked

enter image description here

but the button is visible in the form even when the checkbox is unchecked:

enter image description here

Any help is highly appreciated.

3
  • 1
    Can you share few more details around your issue? For example: Sitecore version, what are you adding in conditions etc.
    – Jitendra
    Apr 11, 2023 at 4:52
  • Can you try with switching condition 2 as first place. By default button render on the page so you need to hide it first and once you check the checkbox button will be displayed. Apr 12, 2023 at 7:44
  • @SumitHelaiya I tried you suggestion but no luck Apr 12, 2023 at 8:55

2 Answers 2

1

Here is a blog that you can refer to know more about JSS – Conclusions after couple of months in large-scale project and you will find some analysis and here is the one that you are looking for.

Sitecore Forms works in JSS but the implementation is React only for:

  • out-of the box and custom form fields support,
  • field value providers,
  • standard and custom submit actions.

There are missing features though (forms conditions), hopefully will be addressed by Sitecore in the future.

This functionality comes out of the box with Sitecore. It isn’t, however, an out of the box feature of the React JSS application. Instead, it requires manual setup.

So as @Andrey mentioned, you need can find how they have setup it manually using this blog.

Sitecore Forms and JSS: Conditional logic in React

2

The JSS React Forms sample does not implement conditions, and you'll need to implement this. See more info here: https://www.codehousegroup.com/insights/sitecore-forms-and-jss-conditional-logic-in-react

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.