Nintex Object Model (Required Field validator to custom properties)
Background: It almost take 2 days to find the way to apply the required field validator to the custom control properties. So I decided to share with this information to all other fobs working with Nintex object model.
Goal: Apply Required Field validator to custom properties.
So apply the required field validator we need to put the following code at the top of the properties attribute section.
[ControlPropertyInfo(ResourceType = typeof(Core),
DisplayName = "MyRrequiredField",
GroupName = "Rrequired",
DisplayOrder = 6,
Required = true,
ChangeAction = ControlPropertyChangeActionType.DoNothing,
TextMode = PropertyTextMode.MultiLine),
Required(ErrorMessageResourceType = typeof(Core), ErrorMessageResourceName = "ValidationFieldRequired"),
DataMember]
public string MyRrequiredField{ get; set; }
Goal: Apply Required Field validator to custom properties.
So apply the required field validator we need to put the following code at the top of the properties attribute section.
Required(ErrorMessageResourceType
= typeof(Core), ErrorMessageResourceName
= "ValidationFieldRequired")
So the full code would be goes like this. The marked yellow are required parameters to make the fields to required.
[ControlPropertyInfo(ResourceType = typeof(Core),
DisplayName = "MyRrequiredField",
GroupName = "Rrequired",
DisplayOrder = 6,
Required = true,
ChangeAction = ControlPropertyChangeActionType.DoNothing,
TextMode = PropertyTextMode.MultiLine),
Required(ErrorMessageResourceType = typeof(Core), ErrorMessageResourceName = "ValidationFieldRequired"),
DataMember]
public string MyRrequiredField{ get; set; }
To more about the nintex object model please go through with my other posts.
Comments
Post a Comment