fluentui-blazor icon indicating copy to clipboard operation
fluentui-blazor copied to clipboard

fix:FluentTextArea enter key valid EditForm

Open be-swarm opened this issue 1 year ago • 5 comments

🐛 Bug Report

When FluentTextArea is used in EditForm when enter key is pressed EditForm is submitted

💻 Code Sample

<EditForm Model="@_current" OnValidSubmit="@ActionNewMailTemplate">
    <BeSwarm.Validator.BlazorValidator ValidateContext="_validatorContext" />
    <FluentTextField Label="Code" @bind-Value=_current.TemplateName></FluentTextField>
    <ValidationMessage For="@(() => _current.TemplateName)" />
    <FluentSwitch @bind-Value=_current.IsBodyHtml>Html</FluentSwitch>
    <FluentTextField Label="Sujet" @bind-Value=_current.Subject></FluentTextField>
    <ValidationMessage For="@(() => _current.Subject)" />
    <FluentTextArea @bind-Value=_current.Body Placeholder="message ..."></FluentTextArea>
    <ValidationMessage For="@(() => _current.Body)" />
    <div>
        <FluentButton Type="ButtonType.Submit" Appearance="Appearance.Accent "> Ajouter</FluentButton>
    </div>
</EditForm>
@code
{
   private async Task ActionNewMailTemplate()
   {
      ....
   }
}

ActionNewMailTemplate is called when enter key is pressed in FluentTextField

Is it possible to prevent this ?

be-swarm avatar Dec 07 '23 13:12 be-swarm

Yes, remove the Type=ButtonType.Submit part from the FluentButton.

This is a workaround. We are looking for a bettter solution. I think this is related to #1050

vnbaaij avatar Dec 07 '23 16:12 vnbaaij

In this case I no longer have editform validation.

be-swarm avatar Dec 07 '23 16:12 be-swarm

Encountering this issue also - Removing the Submit button isn't great as we rely on that for its intended use. As in, we would lose other functionality we intend to keep.

pingu2k4 avatar Dec 07 '23 21:12 pingu2k4

See my additional comment in #1050. This is being caused by a bug in the underlying FAST script and can't be fixed until it is fixed there,

vnbaaij avatar Dec 08 '23 10:12 vnbaaij