How to deactivate an active form in an active loop

Hello,
Someone can please help me understand how to deactivate a form in an active loop if the second input from the user does not fill the required slot?

for example:
when I write a form-type question in Rasa-shell:

> I want to set an alarm.

Then a form (set_an_alarm_form) suppose to be active because a slot is missing (entity name - time). The response from the domain is:

When would you like to set the alarm?

And then if I write a different form-type question:

> What's the weather like in New York?

The first form set_an_alarm_form suppose to be deactivated and a new form (get_weather_in_location_form) supposed to be active and the response from the domain suppose to be:

The weather in New York is 2 ° C.

I want the first form to deactivate and the second response should be about the second form question as usual.

I would be happy if anyone could help on the subject

stories.yml file

- story: Activate set an alarm form
  steps:
  - intent: set_an_alarm
  - action: set_an_alarm_form
  - active_loop: set_an_alarm_form

- story: Activate get weather in location form
  steps:
  - intent: get_weather_in_location
  - action: get_weather_in_location_form
  - active_loop: get_weather_in_location_form

roules.yml file

- rule: Submit set an alarm form
  condition:
  # Condition that form is active.
  - active_loop: set_an_alarm_form
  steps:
  # Form is deactivated
  - action: set_an_alarm_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  # The actions we want to run when the form is submitted.
  - action: action_submit
  - action: action_reset_slot

- rule: Submit get weather in location form
  condition:
  # Condition that form is active.
  - active_loop: get_weather_in_location_form
  steps:
  # Form is deactivated
  - action: get_weather_in_location_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  # The actions we want to run when the form is submitted.
  - action: action_submit
  - action: action_reset_slot

@rotem65400, does this docs page help you on that topic? Forms I think you’re missing an action_deactivate_loop in your rules.

I add action_deactivate_loop in the story file:

    - story: Activate set an alarm form
      steps:
      - intent: set_an_alarm
      - action: action_deactivate_loop
      - action: set_an_alarm_form
      - active_loop: set_an_alarm_form

sometimes it’s work and sometimes not, can you say me where you think that it needs to be at the rule file?

I’m a bit confused - you’re trying to implement form switching right? So if the user says “What’s the weather” during the set_an_alarm_form then you want to activate the weather form right?

You need to have both your regular rules for form activation/deactivation, and additionally separate stories for form switching. So in addition to the stories/rules you have there (i think they should all be rules tbh), you need something like:

stories:
- story: User interrupts form and switches
 steps:
 - intent: set_an_alarm
 - action: set_an_alarm_form
 - active_loop: set_an_alarm_form
 - intent: get_weather_in_location
 - action: action_deactivate_loop
 - active_loop: null
 - action: get_weather_in_location_form
 - active_loop: get_weather_in_location_form