1 Reply Latest reply: May 1, 2013 9:49 AM by jrimblas RSS

    Validation required while pressing a cancel button on DML form

    shiva.kencha
      Hi All,
      we have a interactive report and a dependent form (page1 is a interactive report - and when i click on edit button on page 1 for that particular row - it will open up a dml form.(i,e page 2) )

      now I have two buttons on form (i,e save and cancel buttons) and there are 10 items which are from base table say XX_Table

      New Business requirement:

      when ever user opens the form (i,e page 2 ) and modifies some item on the form and when click on cancel button - it should pop up a message saying that - you have unsaved date - save before you go to master page (i,e page 1)
      if user has not touched any item on page 2 and press on cancel button it should take you to page 1 with out any message pop up.


      can you please provide me the suggestion on how to implement this?

      advance thanks for your help

      with regards
      shiva.kencha
        • 1. Re: Validation required while pressing a cancel button on DML form
          jrimblas
          I'm hoping you're in at least APEX 4.0 or greater. If so, the easy way to handle this is with the Save Before Exit Plugin
          http://www.apex-plugin.com/oracle-apex-plugins/dynamic-action-plugin/skillbuilders-save-before-exit_43.html

          Normally, the plugin will do exactly what you want, BUT will be "smart" enough to let you cancel and not give you message.
          So what you'll need to do is specify the correct "Disable Warning Selector" in the plugin. Usually is set to :button meaning all buttons are valid "exists" from the form. in your case, you may want to be more specific and say that the Save button is the only one valid.
          So if you give your save button an id of say saveBTN then your selected would be #saveBTN instead of the default :button

          Hope this helps.

          Thanks
          -Jorge