Go to Scriptcase store

# onApplicationInit - Form
View video

This event occurs once only when the application is loaded.

First non-formal event executed, being triggered before the assembly of SQL and HTML.

It works as a preparation for an application, since it is possible among other things, various manipulatives, performs validations and changes a connection with a macro sc_change_connection, for example.

See below an example of how you use it.

No example below, or form_orders will be altered according to the user accessing the system.

If variable `[usr_login]` is equal to admin, or user will have access to or form with the possibility of inserting and excluding a registration.

If a variable has some other value, or user still has access to the form, therefore, only with a possibility of altering a registry.

Code example

    if ([usr_login] == 'admin') {

        sc_apl_conf ("form_orders", "insert", "in");

        sc_apl_conf ("form_orders", "remove", "activated");

    } else {

        sc_apl_conf ("form_orders", "insert", "off");

        sc_apl_conf ("form_orders", "remove", "off");

    }