5 Replies · Latest reply on Jan 7, 2018 11:25 PM by Daniel Schmidt

    From UI Action Redirect User to a Specific Field(Change)

      I have modified the cancel change UI Action to require the user to enter a reason for cancelling in the close_notes field. The action works as expected but doesn't give a great user experience. The close notes field sits in a tab called Closure Information. When you select the cancel button it appears to do nothing but the close notes field is now required and there is a message underneath the field requesting a reason. But if the users doesn't look at this tab they wouldn't think nothing happened. What I would like to do is either add a popup message that says please enter reason in close notes or have it redirect the user to the closure information tab. After the last setMandatory line I tried adding gs.addInfoMessage(gs.getMessage('text here'); but it doesn't work. Is there a way to add the popup in the first function or better yet is there a way to redirect the user to the close notes field in the closure information section?

       

       

      function cancelChange(){

        var wn = g_form.getValue('close_notes');

        if (wn == ''){

        g_tabs2Sections.setActive(3);

        g_form.flash('close_notes','red',1);

        g_form.clearMessages('close_notes');

        g_form.showFieldMsg('close_notes','Close Notes are Mandatory when Cancelling a Change','error');

        g_form.setMandatory('close_notes', true);

       

        return false;

       

        }

      gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action

       

      }

        //Code that runs without 'onclick'

      //Ensure call to server-side function with no browser errors

      if (typeof window == 'undefined')

      moveToCancel();

       

       

      function moveToCancel(){

        action.setRedirectURL(current);

       

       

      if (new ChangeRequestStateHandler(current).moveTo("canceled"))

      current.update();

       

      }

      Thanks in Advance

      Keith