How to Use Blazor Editform without model object

Viewed 1995

Iam generating dynamic form in blazor with EDitForm. I don't want to use any model, I just want to read fields by ID and I want to bind data to fields when on EditContext changes. could you please suggest

1 Answers

EditForm is mainly about validating input-- is it the right format (e-mail, phone number, password, etc.).

If you're not using a model, and you don't care about validating the input data, then you can just bind a field to any html control's value For 70% of my inputs, I don't even bother with EditContext / EditForm / Models.

<input @bind="inputvalue" />

@code {
    string inputvalue;
}

By the way, the ID of an element is mostly irrelevant. It's all done through binding and events.

Related