# Forms with list slot

**URL:** <https://forum.rasa.com/t/forms-with-list-slot/52476>\
**Category:** Rasa Open Source\
**Created:** [April 8, 2022, 7:25am UTC](https://forum.rasa.com/t/forms-with-list-slot/52476 "2022-04-08T07:25:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lis/32/18141_2.png) [@lis](https://forum.rasa.com/u/lis)\
**Post date:** [April 8, 2022, 7:25am UTC](https://forum.rasa.com/t/forms-with-list-slot/52476/1 "2022-04-08T07:25:00Z")

</div>

Hi @Juste, I have a use case where I need two types of data to make an api call- numbers(list) and their type(text). I want the user to fill at least one number. Now I’m aware that if I make the number as a list slot the form can exit even if the user does not provide any number. What is the work around to implement a slot that can collect a list of numbers where the bot should exit form only if the user provides at least one number and it’s type

---

<div class="post-metadata">

**Author:** ![lis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lis/32/18141_2.png) [@lis](https://forum.rasa.com/u/lis)\
**Post date:** [April 8, 2022, 10:00am UTC](https://forum.rasa.com/t/forms-with-list-slot/52476/2 "2022-04-08T10:00:09Z")

</div>

Or maybe @nik202 could provide some insights?

---

<div class="post-metadata">

**Author:** ![Gehova](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Gehova](https://forum.rasa.com/u/Gehova)\
**Post date:** [April 8, 2022, 12:47pm UTC](https://forum.rasa.com/t/forms-with-list-slot/52476/3 "2022-04-08T12:47:57Z")

</div>

A [validation custom action](https://rasa.com/docs/rasa/forms/#validating-form-input).

---

<div class="post-metadata">

**Author:** ![lis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lis/32/18141_2.png) [@lis](https://forum.rasa.com/u/lis)\
**Post date:** [April 8, 2022, 1:22pm UTC](https://forum.rasa.com/t/forms-with-list-slot/52476/4 "2022-04-08T13:22:41Z")

</div>

@Gehova can you provide an example? if I’m not wrong a validation function runs after a slot is set. But I have a problem even before that I think. Example:

```auto
User: Can you get user details for B2345, H3456, JY347? //intent is identified here with all the numbers as entities

Bot: Can you provide the type of the customer? //form is activated here and the number slot (list) is filled here

User: Individual //type (text) slot if filled and number slot (list) is set to null

```

My understanding is in the second user utterance, the form is filling both the slots although only the type slot is requested. What should I do prevent this?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [April 8, 2022, 4:33pm UTC](https://forum.rasa.com/t/forms-with-list-slot/52476/5 "2022-04-08T16:33:51Z")

</div>

@lis can you provide some examples?

---

<div class="post-metadata">

**Author:** ![lis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lis/32/18141_2.png) [@lis](https://forum.rasa.com/u/lis)\
**Post date:** [April 11, 2022, 5:19am UTC](https://forum.rasa.com/t/forms-with-list-slot/52476/6 "2022-04-11T05:19:17Z")

</div>

This is my domain.yml file:

```auto
version: '2.0'
config:
  store_entities_as_slots: false
session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

intents:
- user_details:
    use_entities: true
- inform:
    use_entities: true

entities:
- cc_type
- cc_num

slots:
  cc_num:
    type: rasa.shared.core.slots.ListSlot
    initial_value: null
    auto_fill: true
    influence_conversation: true

  cc_type:
    type: rasa.shared.core.slots.TextSlot
    initial_value: null
    auto_fill: true
    influence_conversation: true

responses:
  utter_ask_cc_num:
  - text: Please provide valid cc number(s)
  utter_ask_cc_type:
  - text: Please provide cc type

actions:
- action_user_details
- validate_user_details_form

forms:
  user_details_form:
    required_slots:
      cc_num:
      - entity: cc_num
        intent: user_details
        type: from_entity
      - entity: cc_num
        intent: inform
        type: from_entity
      cc_type:
      - entity: cc_type
        intent: user_details
        type: from_entity
      - entity: cc_type
        intent: inform
        type: from_entity

```

The user details form should collect two types for values - cc\_num which is a list of numbers and cc\_type which is the type of these list of numbers to make a api call later. Now, there are four ways of asking a question as there are two entities in the question (cc\_num and cc\_type):

1. Can you get user details? - the one where the user does not provide entities in the first go. a form is activated and these values are then collected
2. Can you get user details for Y37846, U82374, H237834, Y672389? - the one where one of the entities (cc\_num) is provided in the first go. a form is then activated to collected the other one (cc\_type)
3. Can you get individual user details? - cc\_type is there, need to collect cc\_num
4. Can you get individual user details for Y37846, U82374, H237834, Y672389? - all the required details are provided in one go. A form is activated, sees that all the required slots are filled and proceeds to activate action\_user\_details.

Now the problem I have is, like in the previous comment a slot of type list is expected while requesting for cc\_type slot. (2nd example). So, I want to know if there is another way of approaching this problem. How would you @nik202 solve this?

Thanks in advance!
