1 2 Previous Next 25 Replies Latest reply: Feb 29, 2012 12:59 PM by User374238 Go to original post RSS
      • 15. Re: Validation error message in popup
        jariola
        Hi,


        You mean something like what Roel have post ?
        http://roelhartman.blogspot.com/2009/09/transform-ora-xxxx-messages-into.html


        Regards,
        Jari

        Edited by: jarola on Nov 4, 2010 11:44 AM

        And one way is do your process stuff in validation.
        e.g. create validation "Function Returning Boolean" and code something like
        DECLARE
         l_value VARCHAR2(32700);
        BEGIN
         /* do here your stuff what you do in process */
         
         /* sample code */
         SELECT ename
         INTO l_value
         FROM emp
         WHERE ename = :Px_YOUR_ITEM 
         ;
         /* something here with value*/
         my_stored_procedure(l_value);
        
         RETURN NULL;
        
        -- If Px_YOUR_ITEM value is not found from emp return this error
        EXCEPTION WHEN NO_DATA_FOUND
        THEN
          RETURN 'Your Item value ' || :Px_YOUR_ITEM || ' not found from employee table.';
        
        -- When unexpected error
        WHEN OTHERS THEN
          RETURN 'Some error has occurred. Contact administrator.'
        END;
        In exception handler you can e.g. also log errors to table

        Edited by: jarola on Nov 4, 2010 12:04 PM
        Sample modified
        • 16. Re: Validation error message in popup
          606895
          Hi Jari,

          Yes, something like that. I have tried that method and it didn't work. Some steps were not described very clear.
          Instead of mapping error message from database, I want to show the error message (from process) directly. What I did were:

          1) Modify the Error Page Template Control in Page Template using:
          <script type="text/javascript">$(document).ready(function(){raiseErrorHandler();});</script>
          2) Add Javascript in HTML header:
          <script type="text/javascript">
          
          function raiseErrorHandler(){
            vError = $(".ErrorPageMessage");
            vError.hide();
             var get = new htmldb_Get( null, $v('pFlowId')
                          ,'APPLICATION_PROCESS=GetErrorMessage'
                          ,$v('pFlowStepId'));  
             get.addParam( 'x01', vError.html());
             gReturn = get.get();
             get = null;
             var errArray = gReturn.split("#",2);
             showError( vError, errArray[0], errArray[1]);
          }
          
          function showError(pThis, pTitle, pText){
           vText = '<div id="alert" title="'+pTitle+'">'+'<img src="/i/themes/theme_502/images/Delete.png">
          '+pText+'</div>'
            $(pThis).append(vText);
            $("#alert").dialog({
                         bgiframe: true,
                         modal: true,
                         minHeight : 200,
                         width : 600,
                         closeOnEscape : false,
                         close : function(){window.history.go(-1)},
                         buttons: {
                             Ok: function() {
                               $(this).dialog('close');
                               $("#alert").remove();
                               window.history.go(-1); 
                        }}
             });
          }
          
          </script>
          3) Add a page process GetErrorMessage:
          DECLARE
            p_error_title varchar2(32767); 
            p_ora_error varchar2(32767);
          BEGIN
            p_ora_error := wwv_flow.g_x01;
            p_error_title := 'Error';
            htp.p( p_error_title ||'#'|| p_ora_error );
          END;
          4) I also have another page process which will raise a no_data_found error with customized error message and will be trigged by a button submit.
          declare
            p_id number;
          begin
            select id into p_id
            from tmp_table
            where id=1;
          exception
            when no_data_found then
              RAISE_APPLICATION_ERROR(-20100,'This is an error message.');
          end;
          • 17. Re: Validation error message in popup
            jariola
            Hi,

            I have not used Roels method, sorry.

            Did you check what I edit to my last post ?



            Regards,
            Jari
            • 18. Re: Validation error message in popup
              Bhavin
              Hi Jari,

              Thanks for the solution. It does work fine and I do get dialog. But I need little help, the error(s) also appear on top of notification area.

              What should I need to do just to show only "n errors occurred". I would also like to add color (light pink) & mouse over hint like yours.

              Your help would be appreciated.

              FYI: I am using Apex 4.0 and IE8/FF3.6.

              Kind Regards,
              Bhavin
              • 19. Re: Validation error message in popup
                jariola
                Hi,


                You control inline notification as normally.
                I'm not expert on Apex 4. If your item have attribute "Value Required" Yes,
                I do not know where switch off that notification are message.

                In apex.oracle.com I did set that attribute to No,
                and created normal not null validation where you can control that "Error message display location".


                I post later tip how highlight fields having error


                Regards,
                Jari
                • 20. Re: Validation error message in popup
                  Bhavin
                  Hi Jari,

                  Thanks very much for your reply.

                  I have done as you suggested but now dialog is not appearing, instead I only see errors in Notification area.
                  2 errors have occurred
                  
                      * Dname must have some value.
                      * Loc must have some value.
                  # Set the Required Value to No
                  # Created Item Level Not Null validation for Dname & Loc
                  # Set the Error Message Display Location to - inline Notification

                  I want to see - 2 errors have occurred in Notification area & Validation error message in dialog.

                  Kind Regards,
                  Bhavin
                  • 21. Re: Validation error message in popup
                    jariola
                    Hi,

                    Set the Error Message Display Location "Inline with field".

                    In label template remove all what are in "On Error Before Label" source
                    And "On Error After Label" source replace with something like
                    <script type="text/javascript">
                    $('#errdialog').find('ul').append($('<li/>',{text:'#ERROR_MESSAGE#'}));
                    $(function(){$('##CURRENT_ITEM_NAME#').addClass('ui-state-error').attr({'title':'#ERROR_MESSAGE#'})})
                    </script>
                    ui-state-erro is class from jQuery UI css. I do not know is that class available by default in Apex 4.
                    It might you need load some extra css file. I do not know and have not check/test that.

                    But you can specify own styles e.g. in page HTML header and just replace that class in javascript.



                    Regards,
                    Jari

                    Edited by: jarola on Nov 4, 2010 2:54 PM

                    Edited by: jarola on Nov 4, 2010 3:11 PM


                    Just one more tip:
                    You can create HTML region without template to page zero position "After Header".
                    Place div and javascript from page HTML header and header text to that region.
                    That way you do not need add those to every page.

                    Or alternative you can also include those to page template, if you like.
                    • 22. Re: Validation error message in popup
                      Bhavin
                      Jari,

                      It's all working fine and my query is answered.

                      Thanks very much for your all help and also giving tip for application point of view.

                      Regarding jQuery UI css - ui-state-error class is already available by default in Apex 4.

                      Kind Regards,
                      Bhavin
                      • 23. Re: Validation error message in popup
                        jozef_SVK
                        Hi jarola,

                        I would like to implement this cool stuff to my exists apex applications, but i have no much skills with APEX and JQuery.
                        I tried the examples from this thread, but only one of them works for me. The popup alert message.I created the new label template as a copy of existing one and put the javascript code at the end of the "On Error After Label" section.

                        When i replace the javascript code of the popup with code, where a modal div should be shown, nothing happens.
                        I tried it several times with another examples but without positive result.

                        It is possible, thet there is something wrong with JQuery configuration in APEX ?

                        Sorry for my english, but i am only a novice :D

                        Thanks!

                        J

                        EDIT: I resolve the problem. It was in wrong declaration of the path to jquery ui library.
                        • 24. Re: Validation error message in popup
                          76368
                          Hi,

                          I have exact same requirement. Did you get solution ? I need to display exception/error messages from pl/sql process rather than validation process otherwise I have to do logic twice.
                          If you were able to achive that can you please share the solution
                          • 25. Re: Validation error message in popup
                            User374238
                            Jari, can you teach me how to customize the dialogue box?
                            For instance, change the title background, add a html cancel and ok button...

                            Regards, Leandro Freitas.
                            1 2 Previous Next