Oh, I can see what's happening there.
Javascript popups basically halt the game, so when you chain them together like this, everything happens in the same tick and the ID will not update properly.
I will see what I can do about this. For now you could add a wait action before you open the next dialog. That way the ID will update and the conditions properly trigger.