I created a dropdown to allow me to switch between orders where a user hasn’t submitted their configuration yet (needed for their license generation). What I’m surprised of is that when I switch between order numbers, any chance that I made to the listRepeater entries is also being saved.
I created a “gen license” button for the user to click on that does proper validation for me and submits the data. That works great.
When a user puts garbage in a listRepeater item and switches to a different order number by going to the dropdown and selecting a new order number, whatever they had in those fields is being submitted back to the collection db (also with no validation, which is terrible).
Worst case scenario, I just disable the dropdown, but it is soooo pretty and nice
Here is the relevant code for the dropdown. I did look up everything I’m doing in the Velo API and I don’t see anything that would cause a submit. For instance, the .refresh explicitly says that it does not submit, as does a .value change.
Was able to get help from Wix support. The API is unclear about this, but .setFilter does submit updates. I’m told that they will clarify the API on this.
The unfortunate news with this is that I have to abandon using the dataset and move to using wixData.query and set the repeater to the returned data. I think this means I lose the mapping of the repeater fields to the dataset fields, which means I’d have to manually map the data, which I am not at all looking forward to doing. It seems odd that setFilter would save data like that. I mean, shouldn’t there be an option like setFilter to just set the filter and not saveDatatAndSetFilter? Update the API to reflect reality, sure, but I’d rather the functionality match the implied behavior of the function name (and the API as it is written).
Anyway, I sure wish there was a setFilter() function or other option that would let me keep my drop down with ability to switch values.
In order to view actual test orders on this page (Generate License), you’d have to be me though, since this page only displays the logged-in customer’s order information.
The goal of the page is to allow the customer to see licenses that they have not yet assigned a MAC Address. We display the page by order number (current drop-down selection). A customer could have multiple orders and thus order numbers. The drop-down allows the customer to see other order numbers with licenses that don’t yet have a MAC Address assigned to them. Hopefully that background helps. Thank you.