RasaHQ/rasa-2.x-form-examples

Validation rules for regex-regulated slot while in the active loop of the form

losimons opened this issue · 1 comments

Are there other ways to validate a slot in an ongoing form, except for a custom action?

For example:
You have a form for reporting an incident of a certain device. To do this, you have to provide

  • a 9-digit number which is used by the the company as, lets say, the identifier in the asset management db.
  • describe the issue
  • provide your name
    The identifier is the first slot, and hence doesn't mean "the end of the form". I have the impression that custom validation is always done "at the end" when a form has filled all slots.

Could be nice to have a default validation rule (i.e. fallback sentence with extra instructions) for regex-regulated entities as slots?
In this example: If a user gives 8 numbers (by mistake for example) the bot should be able to say "Small mistake there, I expected 9 digits".

I can add an example like this one to the list.

That said; the first part sounds rather simple. Just a regex-entity-detector and a simple form validator ought to do the trick Typically one applies a validator to a slot directly, not just the end of the form. The current example on validation should show this (the video should launch this week).

The name is a bit trickier, mainly because I'd like the user interface to be a bit nicer. I'd like buttons to appear where you can say yes/no. This involves an extra custom action.