search

Home  >  Q&A  >  body text

How about using Alpine.js for form validation

<p>I am discovering such a great Alpine.js framework. But I can't find how to insert the complete form validation framework. </p> <p>For years I used full JqueryValidation, but it requires JQuery ;-)</p> <p>I tried Ionide.Js but it doesn't have many validators that plug into Laravel. </p> <p>Vue.js has vuelidate and vee-validate, but I don't know how to make them compatible with Alpine.js. Are you? </p> <p>So before I start writing code, I'm here to find out if I'm missing out on some cool receipts for client-side form validation using Alpine.js and a complete set of rules. </p> <p>Thanks and Cheers</p>
P粉345302753P粉345302753572 days ago698

reply all(1)I'll reply

  • P粉968008175

    P粉9680081752023-08-31 14:55:27

    Jquery has a lot of plugins and libraries that are hard to find in Alpine.js, I always look for vanilla js packages, and libraries that can be used with alpine.js. Form validation link is missing in Alpine.js. For form validation I use Pristine.js vanilla js validation library. You can add custom validation rules for fields and available validation rules

    https://github.com/sha256/Pristine

    Here is simple example Pristine used with alpine.js

    https://codepen.io/blcveen/pen/abdpNKW

    Hope this helps you with your form validation issues.

    reply
    0
  • Cancelreply