No announcement yet.

Alert on onValidateSuccess control form

  • Filter
  • Time
  • Show
Clear All
new posts

  • Alert on onValidateSuccess control form

    Hi All,
    What's the best way to add a dialog box after a successful validation? sc_alert doesn't work and echo doesn't give me a the look I want.

    HA! We're all just a little crazy.

  • #2
    What kind of an alert?... if what you want is to send a message with something like "record inserted correctly" or somehting like that you can use the default msg in the application settings.
    Attached Files


    • #3
      Another option is to cheat a bit. In your OnValidate code section use Try-Catch blocks (standard PHP: See the manual about throwing and handling Exceptions: . At the end of the try block use the sc_alert macro to give the user the message. This requires, though, that if there are any application errors that you handle in code, they are to be handled by throwing exceptions. In the catch block you can then use sc_error_message to state the error to the user. Thus, the end of the Try block will only be reached if no errors are encountered, which means that OnValidateSuccess would be the next code to be executed.

      In general if any code section contain more than just a few trivial lines of code, I always use try-catch block and throw for any errors that I check for. In the Catch block I then use sc_error_message or even my own message app if the sc_error_message / sc_alert is not allowed for in Scriptcase code section. A further advantage of using Try-Catch is that it also will catch other unforeseen errors.
      Last edited by Orion; 06-14-2016, 04:50 AM.
      Best regards,



      • #4
        If you want to basically show a message, then just do this:

        echo "<script> alert('YOUR MESSAGE');</script>";