Radio button list validator - triggers on zero

hi guys, this is either a bug or a mis-configuration on my behalf.

i have a radio button list on an ADD screen with two options on it
0 | Incident
1 | Near Hit

it's set up as per below;

when i run the page, if i select the Near Hit option, all works well

however when i hit the Incident option, the validator triggers

the validator is configured with the SCRUD generator, so it's out of the box config here

any ideas to not trigger the validator on 0 | Incident ?

Hi @TMRGlobal,

Try setting the DefaultValue property of the validator to 0.

Thanks @korchev

i have set the default value to 0 (integer)

the page load looks okay, selecting the "near hit" value looks good, changing back to "incident" triggers the validator though

image

so the state was load --> incident selected, select Near hit (good), select Incident (validator triggered)

the only variance is that an incident has a value of 0 while near hit has a value of 1

i'll change the underlying integer and see if this impacts it

okay confirmed

image

when changed values from 0|Incident to 1|Incident the validator worked as expected

from a value perspective, 0 is a perfectly acceptable value, it's not NULL, i think this is a defect in the validator which thinks a 0 int is NULL

for exampole you can use a int to reflect a boolean state 0 = false 1 = true in the above configuration, this validator would behave incorrectly

The validator doesn't think anything. It's implementation is quite trivial to be honest: radzen-blazor/Radzen.Blazor/RadzenRequiredValidator.cs at master · radzenhq/radzen-blazor · GitHub

And here is how HasValue of RadzenRadioButtonList is implemented: radzen-blazor/Radzen.Blazor/FormComponent.cs at master · radzenhq/radzen-blazor · GitHub

The default value depends on the type of the property.