[Feature Request] RadzenCustomValidator #844

Closed
opened 2026-01-29 17:45:10 +00:00 by claunia · 1 comment
Owner

Originally created by @AndrzejKl on GitHub (May 5, 2023).

Is your feature request related to a problem? Please describe.
No;

Describe the solution you'd like
I'm missing a CustomValidator, where I could indicate my own validation guidelines, e.g., check if a value is unique or does not occur more than x times.
I would see it as adding an Action that should return true or false.
Something like:

<RadzenText Name="Name" @bind-Value=customer.Name />
<RadzenCustomValidator Component="Name" Validate="@customValidation" Text="Name need to be unique"/>
@code{
IEnumerable<Customer> customers;  
Customer customer;

  bool customValidation(Customer item)
  {
     return customers.Where(c=>c.Name.ToUpper().Equals(item.Name.ToUpper())).Count() > 0;
  }
}

Describe alternatives you've considered
I've considered <RadzenCompareValidator/> but I it will look weird, something like:

<RadzenText Name="Name" @bind-Value=customer.Name />
<RadzenCompareValidator Component="Name" Value=@targetValue Text="Name need to be unique"/>
...
string targetValue = customers.Where(c=>c.Name.ToUpper().Equals(item.Name.ToUpper())).Count() > 0 ? "" : customer.Name;

Additional context
None;

Originally created by @AndrzejKl on GitHub (May 5, 2023). <!-- IMPORTANT: Read this first!!! 1. If you own a Radzen Professional or Еnterprise subscription you can request your feature via email at info@radzen.com. Radzen staff will reply within 24 hours (Professional) or 16 hours (Enterprise) 2. The Radzen staff guarantees a response to issues in this repo only to paid subscribers. 3. If you have a HOW TO question start a new forum thread in the Radzen Community forum: https://forum.radzen.com. Radzen staff will close issues that are HOWTO questions. 4. Please adhere to the issue template. --> **Is your feature request related to a problem? Please describe.** No; **Describe the solution you'd like** I'm missing a CustomValidator, where I could indicate my own validation guidelines, e.g., check if a value is unique or does not occur more than x times. I would see it as adding an Action that should return true or false. Something like: ``` <RadzenText Name="Name" @bind-Value=customer.Name /> <RadzenCustomValidator Component="Name" Validate="@customValidation" Text="Name need to be unique"/> ``` ``` c# @code{ IEnumerable<Customer> customers; Customer customer; bool customValidation(Customer item) { return customers.Where(c=>c.Name.ToUpper().Equals(item.Name.ToUpper())).Count() > 0; } } ``` **Describe alternatives you've considered** I've considered `<RadzenCompareValidator/>` but I it will look weird, something like: ``` <RadzenText Name="Name" @bind-Value=customer.Name /> <RadzenCompareValidator Component="Name" Value=@targetValue Text="Name need to be unique"/> ``` ```c# ... string targetValue = customers.Where(c=>c.Name.ToUpper().Equals(item.Name.ToUpper())).Count() > 0 ? "" : customer.Name; ``` **Additional context** None;
Author
Owner

@akorchev commented on GitHub (May 23, 2023):

Implemented in https://github.com/radzenhq/radzen-blazor/pull/968

@akorchev commented on GitHub (May 23, 2023): Implemented in https://github.com/radzenhq/radzen-blazor/pull/968
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#844