5 Replies Latest reply on Jun 21, 2019 1:07 PM by Jorgelina1

    Jacvascript - confirm (default cancel)

    tdobe

      Hello,
      I have several procedures in a dynamic action.

       

      0 <--- there?

      1. Execute PL SQL
      2. JavaScript Execute No. 1
      3. Execute JavaScript No. 2
      4....


      The dynamic action is set to work when the "ENTER" key is pressed (in javascript expression: this.browserEvent.which === 13)

      I need that before the three tasks are done, the question arises whether I should continue. The problem is that such a question should contain OK and Cancel buttons, but for the DEFAULT button to be "Cancel": In this question I would like to be able to execute Javascript code - for example to calculate what to display in the question.

      The default javascript confirm works perfectly, after pressing "Cancel" the rest of the procedures will not be performed, the problem is that by default the "OK" key has been set ...

       

      Thx

        • 1. Re: Jacvascript - confirm (default cancel)
          Jorgelina1

          Please, provide the jscript code to understand better what is your issue.

          Regards.

          • 2. Re: Jacvascript - confirm (default cancel)
            tdobe

            it does not really matter what's under the javascript code. I want to save the data by pressing ENTER on the field. And if, the field value is not in the norm, I want to ask "are you sure you want to save the data" ...

            • 3. Re: Jacvascript - confirm (default cancel)
              Franck N

              Hi,

               

              Always provide informations about your environment for a suitable approach to your use case.

              Jorgelina1 has a point here. Why do you have two steps for JQuery ?

               

              Nevertheless depending on your apex Version you could use a true action of type confirm on on your dynamic action :

              Confirm: Displays a confirmation dialog, with Cancel and Ok buttons. If the user chooses Cancel then the proceeding actions are not executed and the current event is canceled.

               

              something like bellow should do the trick

               

               

               

              Regards,

              Franck

              • 4. Re: Jacvascript - confirm (default cancel)
                tdobe

                After all, I wrote that I want to display the confirmation when the value entered exceeds the tolerance.

                 

                :P1_VALUE

                :P1_MIN = 100;

                :P2_MAX = 200;

                 

                steps:

                 

                :P1_VALUE value and enter key:

                 

                 

                1. if the value is not in tolerance, display the question whether to continue ("Tolerance range exceeded, min = 100 and max = 200! Should you continue?") (display a question whether to continue when P1_VALUE is not between P1_MIN and P1_MAX)

                2a. if the answer is yes,

                2b. save the data in the database

                3. execute window operations using javascript (next record from dbgrid, refresh row, and anything else)

                 

                the problem is with point 2b, another problem is that the window with the question should have the default "Cancel" button instead of "OK"

                • 5. Re: Jacvascript - confirm (default cancel)
                  Jorgelina1

                  Hi tdobe,

                   

                  How are you saving your data, through a PL/SQL?  If so... I have a recommendation.

                   

                  On your jscript confirmation request " Do you want to continue? "
                      If NO => proceed normally and nothing will happen    If YES => execute a $.event.trigger("SaveToDatabase")

                   

                  You would have, FIRST, to create a CUSTOM DA. The CUSTOM value should be  "SaveToDatabase", and the Jquery identifier be "body".
                  In that DA, specify the PL/SQL you will use to save the data into the database, or a jscript call with an apex.submit("PROCESS_TO_SAVE_DATA"), where you would have to have a process that should work only wnen request is "PROCESS_TO_SAVE_DATA"...

                   

                   

                  Does this make sense?

                   

                  Regards.