Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

How to set allow anonymous by default


Is there an easy way to override the default settings for FormContainerBlock so that AllowAnonymousSubmission is equal to true by default? There are a few settings we wish to customize in this block and the allow anonymous is one of the most important ones because we MUST allow anonymous on all forms or they will not work. Setting this to true by default will prevent users from accidently creating forms that users cannot submit. 

May 31, 2016 21:19

Either create your own Form block and that inherits from FormContainerBlock override SetDefaultValues, or you can hook up to the CreatingContent event

Cast eventArgs.Content to FormContainerBlock and set the value.

Edited, Jun 01, 2016 7:57

Ah thanks, I was hoping I didn't have to rewrite all the form logic... I have the CreatingContent event working. 

Jun 01, 2016 18:27


Just realized while the event handling does work for creating a new form under the 'Form' assets tab, while creating a form as a block does not trigger this event until after the form is saved. This means that the values do not get set until the form has been created and saved, thus users don't know that it is going to overwrite their values if they decide to leave it unchecked on purpose for some reason. 

What all is required to create my own form block that inherrits from FormContainerBlock? Looking at the FormContainerBlockController if I wanted to make a custom FormContainerBlock I would have to redo almost all of the form controller logic. I'm guessing this is the only way to accomplish this. Scares me overwriting the logic since any form updates and my code is now out of sync. 

Jun 03, 2016 16:55

Did you use creating or created content? This works for me

  • Create new Form (or create new block and select the Form container)
  • Give it a name if you didn't in the first step
  • Go to All Properties mode and verify that the property "Allow anonymous submissions" is checked.

If you create your own formcontainerblock, inherit the original one and the controller will handle your new block as well 

Edited, Jun 03, 2016 17:07

I put a breakpoint on Creating and Created. I did the logic in Creating like you did. If you create a new form by clicking in a content area this does not work (Click "Create new block" in content area. Choose form type). Creating does not get triggered until after the form has been saved. YOu will notice it will not prompt you to change the name of the form until you save it and which point the "creating" event is then triggered. 

Jun 03, 2016 17:56

I did not consider create new block from content area, it did work for me using both "Blocks" and "forms" in the asset panel.

Jun 03, 2016 18:00

Just  checked and noticed that the create block from ContentArea does things in a reversed order basically. Also noticed that the FormContainerBlock didn't hook up to inherited Block Types either :\

How common is it that your editors use that function compared to the Forms tab in the Asset Panel?

Jun 03, 2016 18:57

I ended up figuring out a solution for this. I inherited from FormContainerBlock and gave it a new GUID and Display name. This created two form blocks. I went into admin -> Content Types and disabled the ability for anyone to create a new Form Container Block type thus forcing users to use my custom block. Creating a new form automatically handles this and chooses the custom form by default. Thanks for your suggestions and help!

Jun 03, 2016 19:12

I believe inherit from FormContainerBlock and override SetDefaultValues() is the good solution.

I also think, by default, AllowAnonymousSubmission should be true. We might change this in Forms 3.0

@Alf Nilsson noticed that the FormContainerBlock didn't hook up to inherited Block Types either :\

Could you please, elaborate this?

Jun 13, 2016 9:12
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.