# FormAction multiple validation fail handling

**URL:** <https://forum.rasa.com/t/formaction-multiple-validation-fail-handling/26482>\
**Category:** Getting Started with Rasa\
**Created:** [March 24, 2020, 10:47am UTC](https://forum.rasa.com/t/formaction-multiple-validation-fail-handling/26482 "2020-03-24T10:47:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bendaondrej](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bendaondrej](https://forum.rasa.com/u/bendaondrej)\
**Post date:** [March 24, 2020, 10:47am UTC](https://forum.rasa.com/t/formaction-multiple-validation-fail-handling/26482/1 "2020-03-24T10:47:21Z")

</div>

Hello, I have a form action in which i have validation for a slot (phone number). If user inputs value in wrong format multiple times, i want my bot to stop asking for correct value again, but to continue with different path instead.

In short: i’d like to translate multiple slot-validation fail into specific intent.

What is the best way to do that?

---

<div class="post-metadata">

**Author:** ![saurabh-m523](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/saurabh-m523/32/7887_2.png) [@saurabh-m523](https://forum.rasa.com/u/saurabh-m523)\
**Post date:** [March 24, 2020, 1:35pm UTC](https://forum.rasa.com/t/formaction-multiple-validation-fail-handling/26482/2 "2020-03-24T13:35:59Z")

</div>

Not the best way, but one way could be to keep a `fill_count_slot` and increasing it if the validation fails (you can set other slots as well) and once it reaches a desired value, pass the validation and set it back to zero.

---

<div class="post-metadata">

**Author:** ![bendaondrej](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bendaondrej](https://forum.rasa.com/u/bendaondrej)\
**Post date:** [March 24, 2020, 2:24pm UTC](https://forum.rasa.com/t/formaction-multiple-validation-fail-handling/26482/3 "2020-03-24T14:24:11Z")

</div>

Thank you for response saurabh!. What do you mean by ‘pass the validation’? How?

I’m doing this now:

```
def validate_phone(self, value, dispatcher, tracker, domain):
    if self.isCorrect(value):
            # validation succeeded, set the value of the "cuisine" slot to value
            return {"phone": value}
        else:
            self.number_of_errors = self.number_of_errors + 1

            if self.number_of_errors > 1:
                self.number_of_errors = 0
                raise ActionExecutionRejection(self.name(), "too bad")

            dispatcher.utter_message(template="utter_wrong_phone")
            # validation failed, set this slot to None, meaning the
            # user will be asked for the slot again
            return {"phone": None}

```

I don’t know how to translate raised ActionExecutionRejection to an intent.
