Having trouble validating form slots where a user send text reply instead of using payload buttons

Hello, I’m still new to rasa open source and i’m having trouble with my form validation action. Bascially, I have a form where the slots are filled using enitites directly from the payload i.e.

  - buttons:
    - title: "5 - optionx"
      payload: '/inform{{"result1": 5 }}'
    - title: "4 - optiony"
      payload: '/inform{{"result1": 4 }}'
    - title: "3 - optionz"
      payload: '/inform{{"result1": 3  }}'

The entities and slots from domain are defined as follows:

  - result1

    type: any
    - type: from_entity
      entity: result1

what i want for my validation is when a user decides to type in answer instead of choosing i.e send number 3 for [3 - optionz] instead of the payload for it to be validated via a valildation action… so in this case since it will be in the list of acceptable numbers [5,4,3]. Otherwise a number not in the list gets its value returned as None.

my validate action look like this:

numlist = [ 5, 3, 4]

class ValidateForm(FormValidationAction):

     def name(self) -> Text:
         return "validate_Form"

     def validate_result1(self,
         slot_value: Any,
         dispatcher: CollectingDispatcher,
         tracker: Tracker,
         domain: DomainDict,
     ) -> Dict[Text, Any]:

         ''' validate result1 from question '''
         if slot_value not in numlist:
             dispatcher.utter_message(text=f"Answer not recorded. Please choose from the available choices given")
             return {"result1": None}

         return {"result1": slot_value}

It works fine when a user chooses any of the payload buttons. However when the input is typed in, whether in the numlist or not, my bot goes to listening mode(?). I get no errors but also it goes back to asking for input from user with no message from the bot being displayed. i’d appreciate any help from anyone who would have an idea how to solve it, i have been stuck for a while

You’ll need utterance examples for the inform request. For example:

- intent: inform
  examples: |
    - send number [3](result1)

Thank you, i’ll try this