Adding a accept checkbox to all instances of forms

Vote:
 

Anyone have a prefered way of adding a checkbox (which has validaiton on it to be checked) to all instances forms?

Extend and create a new form and change the template to include checkbox + validation?

Create a block element and always add this somehow to all instances of a specific form type?

Just help user by somehow always adding it to the element list (still removable)?

#188515
Feb 26, 2018 15:40
Vote:
 

You can hook into the ContentCreated event and add your element when a Form newly created. Is that solving your problem?

#188617
Feb 28, 2018 5:19
Vote:
 

Yeah I think it does. Do you happen to have any documentation/examples of this. For the event I guess "formsSetupCompleted" is to be hooked in an InitializationModule. How do I add the my element afterwards?

#188627
Feb 28, 2018 8:37
Vote:
 

"formsSetupCompleted" is javascript event hapen when the form already rendered. It is not for adding element as your requirement.

At the InitializationModule you need get the instance of IContentEvents (https://world.episerver.com/documentation/class-library/?documentId=cms/7/306eae4b-2ba2-dd1e-c114-bccb0d3d2968) by using ServiceLocator, it allows you hook into CreatedContent event. In there, you should check if the content created is your Forms then execute code for adding some initial elements into it.

#188632
Edited, Feb 28, 2018 8:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.