4 Replies Latest reply on Oct 7, 2014 2:09 PM by MatLac

    Best way to create a multi-step validation process

    MatLac Level 3

      I am writing a multi step validation process and I was wondering what is the best method to have it operate on the value.  What I have:

      As a custom validation script, in that order:

      1- Calls a function that looks if the value is part of a particular array

      2- Calls a function that regroup some tests

           2a- function test1()

           2b- function test2()

           2c- function test3()

           2d- function test4()


      What I have now is every test ends as 'event.rc = false' when they fail which is what I need but I also need to stop the entire validation process.  As an example, if the value fails test2() and gets a "you have failed test 2" alert, I don't want to call test3() and test4() since it is already decided that it failed one of the tests.  I could return a boolean that triggers (or not) the next test() but isn't there a simple way to just say


      event.rc = false;



      I have the assumption that break; will only stop the test() but still move on to the next test().  Maybe I can return break; so it will be called from the 'master function'?   Is that even possible?