How to create controls dynamically on button click event?

I want to add a number of the text box on the button click event.
is it possible dynamically? if yes how to create a new control and how to access properties of dynamically created controls.

Hey @Hvishal – I’m not quite sure I follow. Could you give a more concrete example?

Likely, you can do this with a Javascript query that is triggered by clicking on the button. For example, you could have a simple query that just does:

text1.setValue("new value goes here"); 

This will change the value of a text1 to new value here.

Here’s our reference on Scripting Retool from the docs for more info.

It sounds like you might be looking for a listview component, which you can drag other components inside of and iterate copies of.

When you pressed a button, you’d want it to run a Run JS Code type query that returns a number higher or lower to change the number of rows and use that value in the listview’s instances setting. That query might look something like return += 1 and have the query run on load as well.