On a form I have a list of text input so someone can enter a URL. So this list can be dynamically increase or decrease if some clicks on add or remove.
Now issue I am facing is that if I submit 3 links on first form submission then on 2nd I have to submit the same number of links when I just need to add 2. Otherwise I am getting invalidation error.
This usually happens because Retool is keeping track of the number of inputs from the first submission. On the next submit it expects the same structure, so if the array length changes you hit a validation error.
A common workaround is to store your dynamic inputs as an array in a JSON object rather than binding the form directly to individual text inputs. For example, you can:
Use a ListView (or dynamically rendered inputs) but bind their values into a single array state, e.g. tempState.value β ["url1", "url2", "url3"].
On submit, pass only that array to your backend.
This way the form doesnβt care whether you add or remove items, since it always just submits one array field.
That should prevent the invalidation error when the number of inputs changes between submissions.
Thanks for reaching out, @Bilal_Asad! I generally agree with @DavidTech, but want to clarify one thing - have you built a standalone Retool Form or a regular app? Your options will be a little more limited if the former.