Considering this dialog below, how do I:
Create
button default (or submit) button?MudTextField
to submit on return (enter) key press?Adding ButtonType="ButtonType.Submit"
doesn't seem to change anything.
<MudDialog IsVisible="true" Class="pa-4" >
<DialogContent>
<MudTextField @bind-Value="NewName" Label="Name" Variant="Variant.Outlined" />
</DialogContent>
<DialogActions>
<MudButton Variant="Variant.Filled" OnClick="CloseCreateNewNameDialog">Cancel</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="CreateNewName">Create</MudButton>
</DialogActions>
</MudDialog>
Thanks!
To make the create button submit you have to use the Form tag from MudBlazor : https://mudblazor.com/components/form#simple-form-validation
<MudButton Variant="Variant.Filled" ButtonType="ButtonType.Submit" Color="Color.Primary" OnClick="CreateNewName">Create</MudButton>
and to enable MudTextField to submit on return on keypress, use the EventCallBacks OnKeyPress