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

<div class="post-metadata">

**Author:** ![mac\_71128](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@mac\_71128](https://forum.rasa.com/u/mac_71128)\
**Post date:** [August 17, 2019, 3:08pm UTC](https://forum.rasa.com/t/form-deactivation-inside-validate-function/14435/1 "2019-08-17T15:08:13Z")

</div>

I want to change the `validate` function so that I can deactivate my form and delete the value of `requested_slot` before `raise ActionExecutionRejection(...)`.

```auto
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
    """
    # extract other slots that were not requested
    # but set by corresponding entity or trigger intent mapping
    slot_values = self.extract_other_slots(dispatcher, tracker, domain)

    # extract requested slot
    slot_to_fill = tracker.get_slot(REQUESTED_SLOT)
    if slot_to_fill:
        slot_values.update(self.extract_requested_slot(dispatcher, tracker, domain))

        if not slot_values:
	     tracker.active_form = {}
	     tracker.slots["requested_slot"] = None

            # reject to execute the form action
            # if some slot was requested but nothing was extracted
            # it will allow other policies to predict another action
            raise ActionExecutionRejection(
                self.name(),
                "Failed to extract slot {0} "
                "with action {1}"
                "".format(slot_to_fill, self.name()),
            )
    logger.debug("Validating extracted slots: {}".format(slot_values))
    return self.validate_slots(slot_values, dispatcher, tracker, domain)

```

I added these two lines:

```auto
tracker.active_form = {}
tracker.slots["requested_slot"] = None

```

But, they didn’t work and nothing changed. Do you know what is wrong?

---

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