# 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:** 16

<div class="post-metadata">

**Author:** ![humcasma](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@humcasma](https://forum.rasa.com/u/humcasma)\
**Post date:** [January 8, 2021, 11:38am UTC](https://forum.rasa.com/t/form-deactivation-inside-validate-function/14435/16 "2021-01-08T11:38:48Z")

</div>

To reset all slots you can define a custom action:

```
class ActionFlushSlots(Action):

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

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

        slots = []
        for key, value in tracker.current_slot_values().items():
            if value is not None:
                slots.append(SlotSet(key=key, value=None))

        return slots

```

You can invoke this action wherever you want in your stories and rules. Alternatively, you can add to your `validate` function the lines of code inside the `run` method above.

---

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