Code validation doesn't work properly

Hi there,

Maybe someone can help me out with the code validation. It takes me already several days and when one thing goes right the other thing goes wrong.

When I want to fill in the right code: 123456, it should change the price and the button goes to State 2.

When I fill in, for example 123, an error state should be visible and the button should stay the same (State 1).

Discountcode.rp (71.9 KB)

1 Like

See Page 2 of this updated file for a solution.

Discountcode.rp (97.9 KB)

The main thing I changed is the case condition for the “VOEG TOE” button from "If text on Korting Input does not equal “123456” " to "If text on Korting Input does equals “123456”.
I also:

  • Added “Hide Error Message” so that if user first enters anything other than “123456” and gets an error message, it then gets hidden after entering “123456”.
  • Cut & pasted the interaction code from “VOEG TOE” to the parent dynamic panel, “+Voeg toe” because your “Incorrect discountcode” condition sets the panel state to “State 1” --which is redundant as the only way to get this condition is if “+Voeg toe” is already in “State 1”. So, I assume that clicking on “TOEGEVOEGD” should basically do the same thing as “VOEG TOE”. (If not, you can add a condition to test which state is active and handle it that way.
  • Assigned a Submit Button for “Korting Input” to “+ Voeg toe” so that when user presses the keyboard Enter key the interaction code on “+ Voeg toe” is fired just as if it had been clicked. (Common for text and password input fields.)
  • Improved and simplified the cases for Got Focus and Lost Focus of “Korting input”.
  • Cut & pasted the content in State 1 of “Arrow up down toggle” to the main page because nothing changes between the states. Created a Text Link interaction so this follows web standards. Simpler to just have a single “Toggle visibility” code and single text widget, which should help reduce chance of code bugs.
1 Like

Many, many thanks! This was exactly what I needed.

Also nice to learn how to set the interaction code from “VOEG TOE” to the parent dynamic panel and leave State 1 empty.

1 Like