November Happy Hour will be moved to Thursday December 5th.

How to – skip initial content item creation dialog

Vote:
 

Starting with some of the new CMS version (guessing some 11 version) there is new creation dialog upon content item creation.

I want to get rid of Required properties dialog upon new page and block creation (via Blocks gadget).

This has some disadvantages:

Due reasons:

  1. There is need to quickly create new item but required properties does not allowing this. (E.g. during testing)
  2. Working around point 1 results in fact that “required” props are group to Additional properties group. That is not good.
  3. Not all props have so cogent names so they purpose can be easily identified without noting tab they belong to.

I wonder how to skip initial creation dialog on per content type basis. Also some general switch off could be interesting for me.

There is one more creation dialog type. Dialog for new block created via content area. There is always some dialog:

  • Required properties & Additional properties
  • Additional properties only

How to skip all kinds of thoose creation dialogs?

Link to proper documentation page will be sufficient.

Thanks a lot.

(There was once similar question but using IValidate<T> is no generic solution.)

#199822
Edited, Dec 12, 2018 17:12
Vote:
 

Hi,

If you mean the "Required properties" dialog—that has been in place since CMS 7 🙂

Probably the easiest solution is just to create your own ValidationAttribute and use that, if you look at the RequiredAttribute (System.ComponentModel.DataAnnotations) what it does is extremely simple, as an advantage you can also customize and localize the validation message.

#199847
Dec 13, 2018 17:02
Vote:
 

Hi Jiri, if you just want to hide required properties on the create content view then have a look at this post by David: Hiding required properties on the create new page in Episerver

#199854
Dec 13, 2018 20:19
Vote:
 

That blog post from David is really intesting, pretty cool solution.

#199855
Dec 13, 2018 21:01
Vote:
 

Hi,

@Jake Jones: You’re right. The Additional properties dialog confused me. I was not seeing it in previous versions.

@Antti Alasvuo: Thanks for link. This solution is sufficient.

#200006
Dec 20, 2018 14:52
Vote:
 

Hi again,

@Antti Alasvuo: I noticed there is issue with this solution. Check with last comment in disucssion. I cannot remove answer mark due some failure.

I edit my question to reflect the state.

#200008
Edited, Dec 20, 2018 15:42
Vote:
 

Hi Jiri,

If that's the case, wouldn't it be just as easy to create your own RequiredAttribute? Or use IValidate<T> (David's blog post mentions this under "Other approaches")?

#200010
Dec 20, 2018 16:03
Vote:
 

Hi Jake,

custom requiered attribute is solution to this but only in case the block is not created via content area – additional properties get validated upon creation. So functionally the solutions are equal. IValidate is not in any case because (as David noted) it is time and space consuptive.

#200011
Dec 20, 2018 16:36
Vote:
 

Hi,

I tried to skip validation via IContentEvents.CreatingContent but it to late to change SaveAction to skip validation (SaveAction.SkipValidation) in event args.

Is there some work around how to instruct CMS to skip validation on content creations?

#200018
Dec 21, 2018 11:48
Vote:
 

Hi Jiri, you could try again remove the "accept answer" if was just a glitch in the system OR ask support to remove it OR if some of the moderators pick up this chain they can remove the answer (maybe).

Also comment on the linked blog posts comment, David answered you there (and you answered to that), so for others: this behavior might be by design.

#200021
Dec 22, 2018 11:19
Vote:
 

I still think that perhaps you should re-evaluate your requirement to not show dialogs for required properties (if this is only for testers). Easiest solution is to educate/train the users how the 'create new block' works.

I'm not sure if you know also the difference of clicking the 'create a new block' link in content area VS 'new block' in the assets pane? So here goes just in case this is unclear:

  • create new block link in content area creates and publishes the block and returns you to the content where you clicked the link
    • the block is created to 'For This Page' or to the 'For This Block'
    • so it is only usable by the content owning it (page or block)
  • new block in assets page
    • the block is created but not published
    • editor chooses where the block is created
      • can be for this block or for this page
      • fot this site or for all sites (depending if you have site specific assets selected in website settings)

(so the above is related to Davids comment on 'by design behavior').

So here is one hackish solution to work aroud not showing "dialogs" during creating a block.

  • you have to disable the 'create a new block' functionality in content area so that there is only the one workflow for creating a block
  • next you need to set 'default values' for all the required properties
    • so in your content type (block in this case) override the SetDefaultValues and set some value to all the required properties

Sample model:

    [ContentType(DisplayName = "DemoRequiredPropertiesBlock", GUID = "2b2358a0-ce5e-4e5c-ad99-2b89227d3572", Description = "")]
    public class DemoRequiredPropertiesBlock : BlockData
    {
        public override void SetDefaultValues(ContentType contentType)
        {
            base.SetDefaultValues(contentType);
            DisplayName = $"DefaultDisplayName-{DateTime.Now.Ticks}";
            SomeNumber = new Random().Next(1, 99999);
        }

        [Required]
        [CultureSpecific]
        [Display(Name = "DisplayName", Description = "DisplayName field's description", GroupName = SystemTabNames.Content, Order = 1)]
        public virtual string DisplayName { get; set; }

        [Required]
        [Display(Name = "SomeNumber", Description = "SomeNumber field's description", GroupName = SystemTabNames.Content, Order = 2)]
        public virtual int SomeNumber { get; set; }

        [CultureSpecific]
        [Display(Name = "SomeText", Description = "SomeText field's description", GroupName = SystemTabNames.Content, Order = 3)]
        public virtual string SomeText { get; set; }
    }

Now when you create that block only name for the block is required to be entered.

Not exactly what you are looking for but I think the answer is that it can not be achieved fully what you want.

#200023
Edited, Dec 22, 2018 12:28
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.