Try our conversational search powered by Generative AI!

Publish button for blocks disappears with latest Episerver version

Fixed in

EPiServer.CMS.UI 11.4.6

(Or a related package)

Created

May 03, 2018

Updated

May 25, 2018

Area

CMS UI

State

Closed, Duplicate


Description

Steps to reproduce in Alloy Site

1. Change Buttonblock to use [RequiredCustom] attribute.
2. Recompile.
3. In editmode, create a new buttonblock.
4. Publish it right away,
5. Get a validation warning.
6. Enter some text to ButtonText and try to publish again.
7. The publish button is gone.

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public class RequiredCustomAttribute : ValidationAttribute
{
/// <summary>
/// Gets or sets a flag indicating whether the attribute should allow empty strings.
/// </summary>
public bool AllowEmptyStrings

{ get; set; }
public override bool IsValid(object value)
{
if (value == null)
{ return false; }
// only check string length if empty strings are not allowed
var stringValue = value as string;
if (stringValue != null && !AllowEmptyStrings)
{ return stringValue.Trim().Length != 0; }
return true;
}
}
[SiteContentType(GUID = "426CF12F-1F01-4EA0-922F-0778314DDAF0")]
[SiteImageUrl]
public class ButtonBlock : SiteBlockData
{
[Display(Order = 1, GroupName = SystemTabNames.Content)]
[RequiredCustom]
public virtual string ButtonText { get; set; }


[Display(Order = 2, GroupName = SystemTabNames.Content)]
[RequiredCustom]
public virtual Url ButtonLink

{ get; set; }


}

Attachments

packages.config

Publishbutton-problem.mp4

* Please see Zendesk Support tab for further comments and attachments.