Interesting issues here… Not as simple or easy as I first expected.
First of all, whenever you “change” a repeater (add, remove, update, filter, sort, etc.) that repeater’s Item Loaded event is fired. The effect is the entire repeater is basically rebuilt from scratch–so it starts with the default state of all widgets in its repeater cell. This means your text field widget will be blank. To handle this, you’ll need a column to store the contents of the text field, and Item Loaded needs to set the text of this widget using that column. You’ve set this up in Page 2, using the Text Changed event to update its own row. However, the Item Loaded event never sets the text for the text field widget (DateDocReqField). Furthermore, if it did set the text it would create an infinite loop, because that text change would logically trigger the repeater to update again. Most/all browsers will detect this problem and block it so things don’t lock up–so the result would be nothing happens when you try to enter text. You can get around this by using the Key Up event. However using Text Changed or Key Up is very inefficient as it gets fired for every character entered. Might work OK with one row, but with each added row it would get slower and clunkier. Typically in my designs I include a submit button (like “Done” , “Add” , “Update” or a checkmark icon) --which is usually better for usability and accessibility.
In this case, I decided to keep your structure and see if the text field’s Lost Focus event could work to update the row. The way this works in general is that when you select the text field it triggers its Got Focus event, then clicking anything else outside of that text field triggers its Lost Focus --basically signifying the user is done entering text in that field.
It does work, but it created a few new issues.
-
I updated your repeater’s Item Loaded with two cases
Case 1: If [[Item.DataDocReqCell]] equals “” Hide Delete button
Case 2: Else if true Set Text DateDocReqField to [[Item.DataDocReqCell]]
-
It looks like you want the delete button to clear all text, or if empty, delete the row–but not if it is the only row in the repeater. Makes sense, but when you click this delete button the text field loses focus and thus tries to update the repeater–which it does, but this resets the delete button as well, so it didn’t work correctly. To handle this, I added some case logic to the text field’s Lost Focus that tests “If cursor is not over area of Delete button”. This lets the delete button do its job on the current row with no need to update the repeater.
-
the delete button needed some changes to its logic to handle three basic situations (cases):
a. If text field not blank, clear it
b. Else if repeater has more than one row, delete the row
c. If repeater has only one row, just hide the delete button (to create the initial default state)
-
(And this one still has me stumped) your “add 1 more request” button did not work on the first click, but does work on the second click. I thought it might be due to that button being a Master, or perhaps a timing issue with updating the repeater twice (first for Lost Focus, then for the button click) but it turns out it is simply because the button is in a group. I have no idea why, but moving it out of the group allowed it to work correctly on the first click. I would call this an Axure bug. When I ungrouped and then created a dynamic panel of your “2 buttons” everything works correctly.
See Page 3 of this updated file:
2021.02.19 Keeping input text when updating a repeater.rp (160.8 KB)