PiranhaCMS / piranha.core

Piranha CMS is the friendly editor-focused CMS for .NET that can be used both as an integrated CMS or as a headless API.

Home Page:http://piranhacms.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation for a NumberField within the manager

PickleMeSilvers opened this issue · comments

Hello,

For context I am writing code for an archery competition site.

I have the following code and I want the admin user to enter a year that the competition is being run in, e.g. 2023. If the user doesn't enter a value & clicks Publish/Save, I want the manager code to capture this and go back to the user and say, "hey, please enter a year". Or I might want to check that the year is not greater, than say, 2100!

Is it possible to interrogate what is being passed back? At the moment I can't see how I can be the "man in the middle". Many thanks.

[BlockType(Name = "Indoor Championship", Category = "Content", Icon = "fas fa-pound-sign", Component = "indoorChampionship-block")]
public class IndoorChampionshipBlock : TextBlock
{
    public HtmlField HtmlBody { get; set; }

    public NumberField Year { get; set; }
}