• Gamers

    I already created a custom field in the composer, and is working perfect. Now I want to add some validation, just like the one nodebb core has when you try to publish a topic without a title and you get this alert.

    4d34ca5d-cfff-4afc-ad98-ce85a25e074c-image.png

    How can trigger this same alert with a different message and avoid the composer to submit (until this field validates)?

  • NodeBB

    Use 'filter:composer.check'

    hooks.on('filter:composer.check', function (payload) {
         payload.error = 'sorry you can not post now';
         return payload;
    });
    

Suggested Topics

  • 2
  • 1
  • 1
  • 1
  • 4
| |