FormValidationAction is not working with RASA 2.0

FormValidationAction validation is not working.

Action.py

class ValidatePerchaseRequisitionForm(FormValidationAction):
    def name(self) -> Text:
        return "Validate_PurchaseReq_view_form"

    def validate_PR_number(
        self,
        slot_value: Any,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain:  Dict[Text, Any],
    ) -> Dict[Text, Any]:
        if value.isdigit() and len(value) == 6:
            print(value)
            return {"PR_number": value}
        else:
            dispatcher.utter_template(text="Please enter valid User ID!")
            return {"PR_number": None}

domail.yml

actions:
  - Validate_PurchaseReq_view_form

Please review my code. I am not getting any solution. and explain also.

thank you

Hi @sssaha143 :wave: can you show your form definition as well?

hi @m.vielkind . Please help me out

forms:
  PurchaseReq_view_form:
    PR_number:
      - type: from_entity
        entity: PR_number

rule.yml

- rule: Activate View form
  steps:
  - intent: PurchaseReq_view
  - action: PurchaseReq_view_form
  - active_loop: PurchaseReq_view_form

- rule: Submit View form
  condition:
    - active_loop: PurchaseReq_view_form
  steps:
  - action: PurchaseReq_view_form
  - active_loop: null
  - action: action_hello_world
  - action: action_chat_restart

Can you try making two adjustments. Can you try changing your form to:

forms:
  PurchaseReq_view_form:
    PR_number:
      - type: from_entity
        entity: PR_number
      - type: from_text

And then in your validation action there looks like there is one too many arguments:

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

Finally, change the name of the validate action to be lowercase:

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

Let me know if this helps.

@m.vielkind Thank You