Real-World Input Validation Scenarios with Xamarin.CommunityToolkit

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ • 47

  • @CezarWagenheimer
    @CezarWagenheimer 3 роки тому +1

    Another great tutorial for another great feature of the Xamarin Toolkit! Thanks!

    • @jfversluis
      @jfversluis  3 роки тому

      Yaaay thank you for watching!

  • @netdeveloper740
    @netdeveloper740 3 роки тому +1

    Thank you for the video! I would like to know how to enable the button if several fields are validated?

    • @jfversluis
      @jfversluis  3 роки тому +1

      I don’t think we have anything to make that simpler right now. So you would have to check the IsValid of all the fields you want to check and then enable or disable that button

  • @vinaybhavsar8158
    @vinaybhavsar8158 2 роки тому

    Hi Gerald, thank you for posting all xamarin videos. They are really helpful. But I am struggling with one thing here. How can I validate all the fields in a form from my viewmodel method? Suppose I have 20 fields in a form, I don't want to have 20 booleans in my viewmodel for that and then check true for all of them. Is there any easier way to do this?

    • @stanlystan2730
      @stanlystan2730 2 роки тому

      Make a property, that is logical AND for all your IsValid boolean properties. And notify property change when any of them change.
      (This way when you add another IsValid tomorrow, you wont have to change it on all places in your source, and possibly forget one of them leading to a bug)

  • @brandon-butler
    @brandon-butler 3 роки тому

    But how do you handle the user clicking the button directly after typing? If the entry doesn't lose focus the validation logic is not executed.

  • @moatasemkremed5395
    @moatasemkremed5395 3 роки тому +1

    Gerald and Xamarin so amazing

    • @jfversluis
      @jfversluis  3 роки тому +1

      Ha! Thank you so much! ☺️

  • @razorgmx4390
    @razorgmx4390 3 роки тому +1

    About MultiValidation i have 2 more behaviors added and they are not in the example, just don't want to make it more complex. About command i'm using MVVM pattern and trying to separate Visual-View from logic code - ViewModel but in this situatin it's same if i use Clicked event or Command. Thank you and u have all my support

    • @jfversluis
      @jfversluis  3 роки тому

      And thank you for your support! I'm not sure on what you mean by this message though, sorry about that.

    • @razorgmx4390
      @razorgmx4390 3 роки тому +1

      @@jfversluis In 2 words - Following MVVM. I have another suggestion. I'm interest a lot about scanning image to PDF(maybe ussing IOS Api and Android camera API), generating PDF from images etc... Maybe u can make some mini serial about this !

  • @samialfarra4275
    @samialfarra4275 3 роки тому +1

    thank you so much . you are the best in youtube . please question when i set camera option property in camera view to External i cant detect usb camera connected to mobile . in other application in google play i can detect camera . please for what us External property ?

    • @jfversluis
      @jfversluis  3 роки тому

      Ah that’s a good one! I think the external, right now, is just for desktop platforms like UWP. Didn’t even know you could have external cameras on Android 😅
      Thank you for the kind words!

    • @samialfarra4275
      @samialfarra4275 3 роки тому

      @@jfversluis yes i use external canon with video capture card to make full hd live stream with zooming

  • @shazmiah
    @shazmiah 3 роки тому

    Hi Gerald, can you please explain to me how this toolkit behaviour can be used to do form-level validation for all the fields when a user might click a button to move to the next page, from inside a ViewModel please?

    • @jfversluis
      @jfversluis  3 роки тому

      I think we have a PR now that allows you to add validation groups which will make this easier :)

  • @gustavobarbosa8861
    @gustavobarbosa8861 3 роки тому

    Great video Gerald !! One question... how to validate picker using this ? Thanks !!!

    • @jfversluis
      @jfversluis  3 роки тому

      I think there is validators in there that take a DateTime value so use those!

  • @VictorHugo-jr7qu
    @VictorHugo-jr7qu 3 роки тому

    Thanks @Gerald,
    The problem with the XCT validation is that if we have an MVVM pattern implemented, you want to forcevalidation on a command action, rather than a click event. And currently that is not possible.
    However, a quick workaround is:
    // Set this on the content page
    void Button_Clicked(System.Object sender, System.EventArgs e)
    {
    EmailValidator.ForceValidate();
    PasswordRequiredValidator.ForceValidate();
    }
    // then on the command of the viewmodel validate against the validation rules (again).
    I hope we can trigger the validations at some real user interactive actions.

    • @michelmoorlag9028
      @michelmoorlag9028 3 роки тому

      You can Bind the ForceValidateCommand to a command in your viewmodel and on the click of the button call "the bound command".Execute(null) method. It will trigger the validation and there is no need for code behind workarounds.

    • @jfversluis
      @jfversluis  3 роки тому

      Thanks for sharing Michel!

  • @philippedoumet6073
    @philippedoumet6073 3 роки тому +1

    Hello Gerald, please can we make an online Xamarin forms session where you teach me how to include google admob to my app? Please I will pay for it.

    • @jfversluis
      @jfversluis  3 роки тому

      I'd love to help you but I'm afraid I can't do that. Maybe this one will help? github.com/marcojak/MTAdmob
      I'll see if I can create a video about that plugin soon :)

    • @philippedoumet6073
      @philippedoumet6073 3 роки тому

      @@jfversluis ok thanks I'll try it. Do you know how to use firebase?

    • @jfversluis
      @jfversluis  3 роки тому

      @@philippedoumet6073 I've got a sample ready based on that plugin I linked. Might be the video for Thursday!

    • @philippedoumet6073
      @philippedoumet6073 3 роки тому

      @@jfversluis Ok cool! Thanks. Can we make an online session about this? Please I must finish a project for next month... My phone number is: +96170239810

    • @jfversluis
      @jfversluis  3 роки тому

      @@philippedoumet6073 I understand. But as you might imagine I have a pretty full schedule too :)
      As mentioned: I can't, for several reasons, offer any consulting like this. I already prioritized the AdMob video which I hope will help you, there is nothing much else I can do, sorry.

  • @jonkas9058
    @jonkas9058 3 роки тому

    Aren’t these behaviors will cause duplication of code? Well because I need also to do these validations on the business layer. It’s not really DRYish... There must be a better way to do this stuff.

    • @jfversluis
      @jfversluis  3 роки тому

      If that is a requirement you have then you're probably better off writing your own behavior and share the validation logic for sure. I think there are libraries that allow you to share the validation logic some more. Ideally you could share it from the ASP.NET backend all the way to your front-end. Hopefully with .NET MAUI!

  • @revtane9
    @revtane9 3 роки тому

    Everything... just perfection

  • @user_found_200
    @user_found_200 3 роки тому

    Great video!)

    • @jfversluis
      @jfversluis  3 роки тому

      You only say that because you’re in it 😜

    • @user_found_200
      @user_found_200 3 роки тому

      @@jfversluis ahahha
      ....
      noooo

  • @razorgmx4390
    @razorgmx4390 3 роки тому

    *stackoverflow.com/questions/66005951/xamarin-community-toolkit-inputvalidation-connect-with-button/66006437?noredirect=1#comment116713113_66006437* here is the post. Thank you so much for the help

  • @sergiomarquina8828
    @sergiomarquina8828 3 роки тому

    ❤️❤️