# Form deactivation inside validate function

**URL:** <https://forum.rasa.com/t/form-deactivation-inside-validate-function/14435>\
**Category:** Rasa Open Source\
**Created:** [August 17, 2019, 3:08pm UTC](https://forum.rasa.com/t/form-deactivation-inside-validate-function/14435 "2019-08-17T15:08:13Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [August 29, 2019, 11:09am UTC](https://forum.rasa.com/t/form-deactivation-inside-validate-function/14435/4 "2019-08-29T11:09:12Z")

</div>

Hi @mac_71128,

I am currently using this to deactivate a form:

```
def validate(self, dispatcher, tracker, domain):
    # type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
    """Extract and validate value of requested slot.

    If nothing was extracted reject execution of the form action.
    Subclass this method to add custom validation and rejection logic
    """

    slot_to_fill = tracker.get_slot(REQUESTED_SLOT)

    reset = self._check_reset_form_action_on_intent(tracker=tracker, dispatcher=dispatcher)
    if reset:
        return self.deactivate() 

```

Where `self._check_reset_form_action_on_intent(tracker=tracker, dispatcher=dispatcher)` is implemented like this:

```
def _check_reset_form_action_on_intent(self, tracker: Tracker, dispatcher):
    """

    :param tracker:
    :param dispatcher:
    :return:
    """
    last_intent = tracker.latest_message['intent'].get('name')
    if last_intent == 'reset_dialogue':
        dispatcher.utter_message('Okay, gern. Was kann ich sonst für Sie tun?')
        return True
    else:
        return False

```

Of course there won’t be any need of using such a method - you can return the deactivate statement right out of validate, if that suits your case.

Did that help you?

Regards

---

_[View the full topic](https://forum.rasa.com/t/form-deactivation-inside-validate-function/14435)._
