Hi there,
I am making a completely custom bookings page. I have a repeater in which each element is a new booking. Inside each element is a few user input elements i.e. service, time, tutor name etc. I have buttons with code that either add or removes elements from the repeater using the data of the repeater (not by adding or deleting entries in a dataset).
ISSUE:
For ONLY the second element, so the first time I click my “add” button the user input elements do not update their values upon their FIRST change.
So I add my second booking → the new booking appears → I select a service type from my services dropdown and $item(‘#services’) .value reads null → Same if I try to select a new tutor name for the FIRST time the value property reads null.
I can then reselect the exact same option from that dropdown and it works perfectly! the value reads what I select from the dropdown.
Here is my who_change function called whenever there is a change to the tutor selection dropdown: (pretty much just note the console log of the value)
export function who_change(event) {
//Add your code for this event here:
// need to update the item data;
let $item = $w.at(event.context);
let id = event.context.itemId;
console.log("value: " + $item(‘#who’).value)
console.log("placeholder: " + $item(‘#who’).placeholder)
$item(‘#who’).placeholder = $item(‘#who’).value;
update_booking($item, “who”, id);
}
Below are console outputs showing the behaviour:
Case 1: page opens like this
Hit add - > new booking shows
Change value for the first time
Output: → value is null
Re-select from dropdown again: → value is what is selected
Some examples of behaviour see link to play around:
Hit add button → hit remove on that new element immediately → hit add again to recreate second element → works fine
Hit add button twice → user-inputs don’t work on the first new element but work completely fine on the second new element
Hit add button as many time as you want and everything works perfectly except for the first ever added element and that works perfectly fine after changing each element once
Unfortunately, it is apart of a dynamic page which you will need to be a member of my site for. So if you want to view it first hand let me know and I will sort it out.