I have a dropdown I populate via code (not directly connected to a data collection. See lines 124 & 127.
Then I have an onChange event where I first check if the field is valid. See the second image.
The data population seems to work as the values are present. I start off with no value in the drop-down pre-selected.
PROBLEM: The weird part is, when a value is selected, it fails the validation check saying the value is missing. I can log to the console the value of the drop-down right before checking if it is valid and the value is most certainly there.
Then to make it even weirder, if you toggle the drop-down options, everything works. So when the very first selection is made, it for some reason thinks the value is missing using .valid. I've even toggled to another option and then gone back to the first one and it will work. See the video.
Ideas...
Hi Neff 🖐
Instead of using the valid method on the dropdown menu, use the selectedIndex, or the value method, I'll give you an example on both of them.
Option #1: Selected Index.
if ($w('#ddRoomTyped').selectedIndex !== undefined) { // Run your code here }
Option #2: Value.
if ($w('#ddRoomTyped').value !== '') { // Run your code here }
Either ways, it should work just fine.
Hope this helps~!
Ahmad