Hi, I am building a custom code for the dropdown as the platform does not allow me to make it.
So I did that when the user presses the dropdown menu - when the dropdown aria-expanded == true - it sends a webhook request gets the data I need packs it and sends me back as a text response, I am taking the response, splitting then adding each one as a li element within the ul element that is created within the div[role=“presentation”] element that’s being created when the aria-expanded is true, everything is working well, I am able to select the items and I correctly modified every class and attribute that they need to have, I also set the value of the input element that comes with the div element in which the selected item is represented.
However, when I click the submit button on my form, it throws an error that the field is required, meaning it does not see that I chose an item there, but both the item text and the hidden input value are present.
How can I fix it. I need to know how the backend works, I found some hints to how it works in the sources tab but I need this to work.
The platform is good, but not fit for custom code, remove the update of the DOM that happens every moment, it is annoying, I have to use mutation observer just to be able to find something in the DOM.
Yeah I know I made sure the selectors are good, my code handles them.
So what I did to fix the issue is that I just turned off the “required” field for the dropdown element and then in my webhook before sending the request I once again changed the value using setAttribute and then took the textContent from the div element that holds the text and sent the data taken from the value of the input element. It worked.
Thanks, but yeah, the experience is, lets call it funny.
Good but again, careful, the selectors are not that good as they are not stable => they might change in a week or in a month.
The custom code you have might handle the selectors today but not over the time.
Just a warning in case you see something broken one day for no reason
Yeah that’s unfortunate, building this platform for a custom request, though they will take our monthly maintenance plan so I think we should be good until you fix the issues with the forms, if not, I might migrate the platform.