2 Replies Latest reply on Dec 10, 2013 12:33 AM by ApexPhil

    Apex Button Function


      Hello Everyone,

      I am trying to make a button in Apex submit a page and execute validations while redirecting to another page. I can easily do one or the other through the "Action when clicked" ability, but is there a way to get both functions out of the same button at the same time? Thank you


        • 1. Re: Apex Button Function

          Hi Tim,


          You can create a button of type submit, and choose the name of that button in your validation attribute "When Button Pressed".





          • 2. Re: Apex Button Function

            This works for me:


            1) create an application item called APP_ERROR


            2) create a branch process that consists of a PL/SQL function returning a page number. The code can be something like this:


            if 1=1 -- put your validation here

            then :app_error := 'Validation error';

            return 10;

            else return 20;

            end if;


            3) In the page you want to branch to (i.e. 10) have a before header process with this code:


            if :app_error is not null

            then apex_application.g_notification := :app_error;

                  :app_error := null;

            end if;


            If you need it to work for a certain button then just check the value or request when you do the validation in step 2.