# Insert multiple input text box programmatically

**URL:** <https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504>\
**Category:** Using Streamlit\
**Tags:** windows\
**Created:** [May 31, 2021, 10:44pm UTC](https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504 "2021-05-31T22:44:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vismay\_Srivastava](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vismay_srivastava/32/8256_2.png) [@Vismay\_Srivastava](https://discuss.streamlit.io/u/Vismay_Srivastava)\
**Post date:** [May 31, 2021, 10:44pm UTC](https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504/1 "2021-05-31T22:44:44Z")

</div>

import streamlit as st

noOfMeetings = st.number\_input(‘Select the number of meetings:’,step=1)  
meetingDetails = {}  
if st.button(“Submit Button”):  
for i in range(int(noOfMeetings)):  
meetingDetails[“meeting”+str(i)]=""  
else:  
noOfMeetings = 0

for k, v in meetingDetails.items():  
meetingDetails[k] = st.text\_input(k, v)  
st.write(meetingDetails[k])

Hi, In this code I want to input the number of meetings and create as many input boxes according to that.  
When I run this piece of code, the appeared textboxes disappear after entering any text.  
Please help me with this

---

<div class="post-metadata">

**Author:** ![BeyondMyself](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/beyondmyself/32/7525_2.png) [@BeyondMyself](https://discuss.streamlit.io/u/BeyondMyself)\
**Post date:** [June 1, 2021, 12:47am UTC](https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504/2 "2021-06-01T00:47:54Z")

</div>

you defined a dictionary to save information.  
but the dictionary has no content because your code is: “meetingDetails[“meeting”+str(i)]=”" "  
so st.write will not print any content.

---

<div class="post-metadata">

**Author:** ![Vismay\_Srivastava](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vismay_srivastava/32/8256_2.png) [@Vismay\_Srivastava](https://discuss.streamlit.io/u/Vismay_Srivastava)\
**Post date:** [June 1, 2021, 10:39am UTC](https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504/3 "2021-06-01T10:39:30Z")

</div>

It is fine if it doesn’t print anything, but why do the textboxes that have been added programmatically disappear on typing text. That is my main query here

---

<div class="post-metadata">

**Author:** ![Venkatesh](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Venkatesh](https://discuss.streamlit.io/u/Venkatesh)\
**Post date:** [June 1, 2021, 12:30pm UTC](https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504/4 "2021-06-01T12:30:58Z")

</div>

Hi,  
**Solution one.**  
Streamlit runs the codes every time you interact with the widget. Button value will be True if you click and automatically changes its value to False upon interacting with the text widget.  
Replace the button widget with the checkbox.

**Solution two.**  
If you want to keep button widget, use `st.empty` place holder in the first for loop. Then replace with text input in the next loop

**Solution Three**  
Use sessionstate,

> <https://github.com/gaurav-gunhawk/Python/blob/master/Streamlit/Streamlit-SessionStateManagement.py>

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [August 15, 2022, 8:34pm UTC](https://discuss.streamlit.io/t/insert-multiple-input-text-box-programmatically/13504/5 "2022-08-15T20:34:13Z")

</div>


