Required attribute per event/SaveAction or alike to avoid "create view with required fields only"

Vote:
 

We have request for customers that models with Required-attributes should not render that "create view with required fields only", inexperienced users gets confused and don't understand where all other fields are.

If we could set [Required(SaveAction.Publish)] or something, we could tell that these Required-fields are required when publishing, not for creating etc.

Or maybe there should be a possibility to annotate the model with something that forces showing complete edit view on creation?

I understand the customers request and feel it would be a nice feature to make a more solid experience for some customers.

#210716
Edited, Dec 04, 2019 9:13
Vote:
 

You could create your custom validation attribute, like this:

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public sealed class RequiredForPublishAttribute : ValidationAttribute
{
	const string defaultMessage = "{0} is a required property!";
	private bool IsDefaultMessage = true;
	
	public PropertyRequired()
	{
		
	}

	public PropertyRequired(string message)
	{            
		ErrorMessage = message;
		IsDefaultMessage = false;
	}

	
	public override bool IsValid(object value)
	{
		return !value.IsNull();
	}


	public override string FormatErrorMessage(string name)
	{
		return IsDefaultMessage ? string.Format(defaultMessage, name) : ErrorMessage;
	}
}

...then just replace [Required] with [RequiredForPublish].

#210721
Edited, Dec 04, 2019 10:37
* 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.