mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
30 lines
749 B
C#
30 lines
749 B
C#
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using BTCPayServer.Abstractions.Form;
|
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
|
|
namespace BTCPayServer.Forms;
|
|
|
|
public class HtmlSelectFormProvider : FormComponentProviderBase
|
|
{
|
|
public override void Register(Dictionary<string, IFormComponentProvider> typeToComponentProvider)
|
|
{
|
|
typeToComponentProvider.Add("select", this);
|
|
}
|
|
|
|
public override string View => "Forms/SelectElement";
|
|
|
|
public override void Validate(Form form, Field field)
|
|
{
|
|
if (field.Required)
|
|
{
|
|
ValidateField<RequiredAttribute>(field);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class SelectField : Field
|
|
{
|
|
public List<SelectListItem> Options { get; set; }
|
|
}
|