Prevalidate forms in Laravel and InertiaJS applications

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 พ.ย. 2024

ความคิดเห็น • 24

  • @mahmudsulemansheikhwunnam3580
    @mahmudsulemansheikhwunnam3580 2 ปีที่แล้ว +2

    I discovered this channel yesterday and I really enjoy your content. Thanks a lot.

    • @cdruc
      @cdruc  2 ปีที่แล้ว

      Glad you enjoy it - hope you find the other videos useful as well! 😃

  • @jameswong3388
    @jameswong3388 2 ปีที่แล้ว +3

    srssly love what you're doing right now
    thx so much !!!!!!!

    • @cdruc
      @cdruc  2 ปีที่แล้ว

      Oh, thanks! 😃

  • @nadjinmalade8738
    @nadjinmalade8738 2 ปีที่แล้ว +1

    I always learn new things on your videos. Thanks for your videos.

    • @cdruc
      @cdruc  2 ปีที่แล้ว

      Glad to hear you find them useful! 😀

  • @matthieulabaune1766
    @matthieulabaune1766 2 ปีที่แล้ว +1

    Very clever !!! Thanks a lot Constantin, I have learned so much from you in order to progress from junior to intermediate developer. 🤩

    • @cdruc
      @cdruc  2 ปีที่แล้ว +1

      You're very welcome! Good luck and never stop learning 👊!

    • @matthieulabaune1766
      @matthieulabaune1766 2 ปีที่แล้ว

      @@cdruc 💪

  • @pascalraymond8424
    @pascalraymond8424 2 ปีที่แล้ว +1

    Very clever point again!
    Thanks for sharing about Inertia and diving into laravel code too 😊

    • @cdruc
      @cdruc  2 ปีที่แล้ว

      Thanks! 😊

  • @andersandersson3412
    @andersandersson3412 2 ปีที่แล้ว +2

    Thank you for the idea and amazing video! One suggestion though. Put only: ['errors'] to Inertia visit call.

    • @cdruc
      @cdruc  2 ปีที่แล้ว

      Oh, nice catch! Thanks!

  • @jakjr98
    @jakjr98 2 ปีที่แล้ว +1

    Nice! Nice! Nice! Very good job!

  • @bhaidar
    @bhaidar ปีที่แล้ว

    Great video as usual! However, I have a question related to "touchedFields". It's defined as a normal variable and not as a ref() and still it works! Why would you choose a normal variable and not ref in this case? Thank you

  • @empty7999
    @empty7999 2 ปีที่แล้ว

    This is the first time I'm writing a comment here , I just want to say thank you so much for your amazing videos 🔥

    • @cdruc
      @cdruc  2 ปีที่แล้ว

      My pleasure 😊

  • @MrFixIt-le7rs
    @MrFixIt-le7rs ปีที่แล้ว

    I have a question, what if you were doing some process inside the store method and and error may occur, how do you handle this error?
    And if the data is stored successfully, how do you return a feedback to client side -something toast notification without page reload. Just like in axios where you can handle response and perhaps do something with the response.

  • @SilVer-hu2ps
    @SilVer-hu2ps 2 ปีที่แล้ว

    I'm currently trying to learn laravel + vue + inertia. I have a question, is it just me or whenever I click back button after logging out, I can still access the previous page and submit some data?

  • @Raihan004
    @Raihan004 2 ปีที่แล้ว

    best of luck

  • @kevinwakhisi7001
    @kevinwakhisi7001 2 ปีที่แล้ว

    I was wondering how to remake this without inertia. I am using laravel with vue 3 as a single-page application. For starters, I noticed there are inertia forms and the inertia route. I am using plain bootstrap forms and normal Axios for my request. Please help me out.

    • @cdruc
      @cdruc  2 ปีที่แล้ว +1

      It should be possible without inertia. Most of the changes should revolve around making the request with axios and then store the errors we get back into a reactive object we then use to display the error messages.
      I'm thinking of doing a video on Laravel + Vue SPA sometimes in the future. If that will happen, I will make sure to include this topic as well 👍

    • @kevinwakhisi7001
      @kevinwakhisi7001 2 ปีที่แล้ว

      @@cdruc Hey i did get the errors displayed but the issue is that it still does not flash the unwanted text input.
      function validate() {
      if (!needsValidation) return;
      needsValidation = false;
      try {
      method({ ...form, prevalidate: true })
      } catch (e) {
      if (e.response.status === 422) {
      Object.keys(e).filter(field => !touchedFields.has(field)).forEach(field => delete e[field]);
      errors.value = e.response.data.errors
      }
      }
      }
      This is the validate composable. how else could i structure this?

  • @henochangemichaellonzokoff6036
    @henochangemichaellonzokoff6036 2 ปีที่แล้ว

    j'ai une erreur 403