Design Studio clear fields on AP20.1

 6 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
TracyO
Veteran Member
Posts: 97
Veteran Member

    I have created a Design Studio form for our AP20.1 screen where I have moved 3 user fields to the main tab.  I have also made these fields be required based on the account number.  I know want to find a way to clear of  just the user fields, as we do not want to clear the co/au/account because they are always the same.  It looks like everytime after you do an add or change on this screen the cursor postions itself on the company field.  I am thinking I need to do an OnBlur function, so as soon as they move off this field to enter more lines the old user field informataion is cleared.  Has anyone done something similiar?  Do you think the OnBlur is the way to proceed or have any other suggestions?

    Thanks

    Tracy

    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      You could also clear the fields - lawForm.setFormValue("text11","") - after you perform your Add or Change.
      David Williams
      TracyO
      Veteran Member
      Posts: 97
      Veteran Member

        David

        Would that be the OnAfterTransaction function?  I have not had much time to work with that one, but when I have tried it in the past it ignored my add or change and did the fucntions no matter what FC I used. 

        wilcoxmad
        Veteran Member
        Posts: 87
        Veteran Member

          I had problems with FC too - this worked for me.

          function FORM_OnBeforeTransaction(fc)
          {
          return ( fc == "A" ? initF() : true );
          }

          function initF()
          {

          //whatever you need to do here

          }

          OR try this...

           

          function FORM_OnAfterTransaction (data)
          {

                if (data.selectSingleNode("//_f1").text == "A")

                    {

                      //whatever you need to do here

                     }

          }

          TracyO
          Veteran Member
          Posts: 97
          Veteran Member

            I will try those.

            Thanks

            TracyO
            Veteran Member
            Posts: 97
            Veteran Member

              I have tried the OnAFterTransaction as below but both of them are triggering BEFORE the invoice is actually added.  The box pops up, then when I click on the okay, it then adds the invoice.  Any other suggestions?

              /*function FORM_OnAfterTransaction (data)
              {

                   if (data.selectSingleNode("//_f1").text == "A")

                        {
                         // for (var i = 0; i <= 99; i++) ;
                   window.alert ("This is where it is")
                         // lawForm.setFormValue("text77","",i);
                         }

              }

              */

               

              Also tried:
               
              function FORM_OnAfterTransaction(val)
              {

              if(val.selectSingleNode("//_f1").text=="A" && lawForm.getMessage()=="Add Complete - Continue")
              {
              window.alert ("This is where it is")
              }
              return true;

              wilcoxmad
              Veteran Member
              Posts: 87
              Veteran Member

                Tracy, I had very similar issue on HR11. I wanted to call PA12(Emergency Contact Info) after the employee is added. This worked for me. I assume you have checked the exact message being returned? The compare is of course case sensitive.

                function FORM_OnAfterTransaction (data)
                {
                 if (formState.agsError) return;
                 
                 //Check error message for :Add complete" - exit if not
                 sMsg=lawForm.getMessage();
                 sMsg = sMsg.substr(0,5);

                 if (sMsg != "Add c") return;

                 if (data.selectSingleNode("//_f1").text == "A")
                  {
                          callpa12();                           

                   }
                }

                Hope that helps!