Anyone successfully setup abide for client side validation?

Anyone successfully setup abide for client side validation?

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

I understand editor is focused on server side validation, but wondering if anyone has successfully gotten a client side framework like abide integrated into their workflow? Would be interested to see an example of so.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin
    Answer ✓

    It is possible to set attributes on the input elements that Editor renders into the document via the attr option that is available for all field types - e.g.:

    {
      name: 'Location',
      type: 'text',
      attr: {
        required: true
      }
    }
    

    That alone will get you a fair way with libraries such as Abide but it isn't going to solve all of the issue. Error messages won't automatically be controlled just from the attributes for example.

    Also, for anything that needs a Javascript check you either need to add suitable event listeners to the input element(s) or use preSubmit to perform the validation and display error messages.

    Allan

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    THanks @allan I was planning to use the presubmit to check and perform the validation, but was building out a ridiciulous script to add the tags to the fields themselves, so the attr should help with that.
    Thanks!

This discussion has been closed.