2

I need to render a Sitecore Form using the Sitecore Scriban Template. I see there is an implementation provided in Stack Exchange using MVC View. But is it possible using scriban?

2 Answers 2

1

You would probably be able to do this with a VariantComponentField as a child item of your scriban template item, and using that to add an Sitecore Form Wrapper and set the rendering parameters.

You can then run sc_execute to execute the component field.

Reference: https://doc.sitecore.com/xp/en/developers/sxa/93/sitecore-experience-accelerator/the-embedded-functions-for-the-scriban-template.html#sc_execute

1

I think, what you need to do is to add a Scriban template and underneath that, add a Component item.

Setup the Form in there (use MVC Form as the rendering and set the configuration). Then in the Scriban template, use {{ sc_execute "[CompoentItemName]" }} to add that.

It should work.

1
  • Tried as you mentioned. Created a component under scriban template. Set the Rendering as Renderings/System/Forms/MVC Form and also provided the datasource which is the form path. This works fine where the Form is getting rendered properly. However the requirement is to choose any form from the forms collection and it should be dynamic.. May 19, 2022 at 19:18

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.