I am trying to do some data validation in a view contained in a carousel of views for the settings in my web app. When switching to another view within the carousel, I want to validate the data in the current page and prevent moving on until the data is valid.
I use setActive() to set the carousel page back to the current page, and show an alert explaining the reason the data is not valid. When I click OK in the alert, the background (the carousel page) lightens up, but the alert is not dismissed. The second click dismisses the alert.
Interestingly, when I added a callback, the callback was called upon the first click of the OK button, but the alert was not dismissed until the second click.
If I comment out the setActive call, the alert works as expected. So that seems to be the key. It does not matter whether the setActive is done before or after the alert is shown.
You can try this in my web app at Gradekeeper
Click the setup tab on the lower right. Click the right arrow in the carousel twice. Enter some letters for the final exam percent. Click the right arrow again. This will show the error alert. Click OK once. Click OK again.
If there is some approach to doing this that will work, please let me know.