Code Monkey home page Code Monkey logo

Comments (5)

vnbaaij avatar vnbaaij commented on July 4, 2024

Hi,

Provided sample code is not ready-to-run. Please complement.

from fluentui-blazor.

MertYacan avatar MertYacan commented on July 4, 2024

Hi,

I am sorry. It should be ready-to-run now.

I realized when I run the app, and click submit it won't show the error message.

If i write something inside the description and clear the description again, then it will start to show the error message.

Thank you.

from fluentui-blazor.

vnbaaij avatar vnbaaij commented on July 4, 2024

It seems the standard HTML 5 validation checking and the FluentTextArea are not playing together nicely. I'll need to look into that further.

In the meantime I would advise you to not use the standard HTML validation but use Blazor's icw ours. Here is what you need to do:

  1. add @using System.ComponentModel.DataAnnotations at the top of your page
  2. add novalidate to your EditForm tag
  3. change your CreateBatchLeaveExcelDto class to have:
 [Required(ErrorMessage = "Description is required")]
 public string? Description { get; set; }

Then clicking submit will show you an error immediately(*)
image

Added benefit is that it will show the errors in the correct Fluent Design (as shown above) instead of the generic design (as shown below)
image
(which looks way worse if you ask ,e

(*) It will show the red border if below is in your CSS somewhere. I'm currently working on this and it will be automatically included in next release

fluent-text-area.invalid::part(control), 
fluent-text-field.invalid::part(root) {
    outline: calc(var(--stroke-width)* 1px) solid var(--error);
}

PS: Setting `Required="true" on a field does not automatically add any checks or logic. It's sole task (currently) is to display the required indicator (the red *)

from fluentui-blazor.

vnbaaij avatar vnbaaij commented on July 4, 2024

Closing this as a workaround is provided

from fluentui-blazor.

MertYacan avatar MertYacan commented on July 4, 2024

Hi Vincent,

Thank you very much for the detailed explanation. It worked with your suggested changes.

from fluentui-blazor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.