Do you want to change the way Sitecore Forms generates ids or any attributes? Then follow through this short post.
Create a new class extending
Sitecore.Mvc.Pipelines.MvcPipelineProcessor with the type
Add the following code:
Changing the id can break the Forms functionality. That’s why we need to create a hidden field to work this around.
Create a new class named CreateHiddenFields and add the following code:
Finally, add a config file patching to the forms.renderForm pipeline right after the processor
This way you can change how Sitecore Forms generates the id attribute.
Update July 24, 2020
Rodrigo has shared his complete code on changing the Form’s id. He tackled all the side effects and bugs. Please, check this out http://blog.peplau.com.br/en_US/bug-free-custom-form-ids-in-sitecore-forms.
Thanks Rodrigo for providing most of the sample code and finding about the breaking changes when you modify the form id.comments powered by Disqus