2 Replies Latest reply: Dec 9, 2013 6:33 PM by ApexPhil RSS

    Apex Button Function

    60aae272-ac6b-47f5-ad21-f0e71ef5dbaf

      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

      Tim

        • 1. Re: Apex Button Function
          vincent_deelen

          Hi Tim,

           

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

           

          Regards,

          Vincent

          http://vincentdeelen.blogspot.com

          • 2. Re: Apex Button Function
            ApexPhil

            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.