In order for validators to work two things should happen:
- They should be put inside RadzenTemplateForm
- The form should submit. This needs a
<button>
with typesubmit
to be put inside the form itself.
Try this:
<RadzenTemplateForm TModel="Thing" Data="Stuff">
<ChildComponent Project="model" />
<button type="submit" class="btn btn-primary" @onclick="@(() => @Save(false))">Save</button>
<button type="submit" class="btn btn-primary" @onclick="@(() => @Save(true))">Save & Add Formula</button>
</RadzenTemplateForm>
And handle the Submit event of the form instead of handling the click event of the buttons - they will fire unconditionally regardless of validation status. If you want to have multiple submit buttons check this thread: Multiple Submit Buttons - #4 by korchev