1 Reply Latest reply on Nov 9, 2013 8:17 AM by jasotastic81

    Can you duplicate actions?


      I've recently started creating a order form which will automatically fill in either the item description, product number, or unit price once selected either the product number or item description from the drop down box.


      I made a smaller trial version of this form and it worked perfectly however adding all the possible 'actions' for when selecting from the drop down box took a very long time. The real order form will have a lot more items to choose from therefore will take even more time, which I don't have.


      Is there a way to copy the actions I have for the first row (Product01, Description01, Unit01) for the rest of the rows in the order form, all I would need to change is the Product01 to Product02 etc etc.


      This is what my table in my order form looks like:

      Product No:
      Quantity Unit Price Total
      PN01Description 01QTY 01UNIT 01TTL 01
      PN02Description 02 QTY 02UNIT 02TTL 01
      PN03Description 03 QTY 03UNIT 03TTL 03
      PNO4Description 04 QTY 04UNIT 04TTL 04

      Field Names

      Product No & Description are both drop down boxs


      This is the code for one of the actions:


      //- //+ GENERATED - DO NOT EDIT (ID:5F8FCFED-90F7-48DF-9CDA-91C02E1BC86F CRC:3737938537) //+ Type: Action //+ Result2: SetFieldValue("$Node3","tovalue","4.99") //+ Result1: SetFieldValue("$Node2","tovalue","Quality safety spectacles") //+ Node3: topmostSubform[0].Page1[0].UNIT_01[0] //+ Node2: topmostSubform[0].Page1[0].Description_01[0] //+ Node1: topmostSubform[0].Page1[0].PN01[0] //+ Condition1: ListField("$Node1","textselected","NB04B") //+ ActionName: PN01.change if ($.boundItem(xfa.event.newText) == "NB04B") { this.resolveNode("Description_01").rawValue = "Quality safety spectacles"; this.resolveNode("UNIT_01").rawValue = "4.99"; }


      I just used an action builder to create these actions.


      If someone could explain a way to copy these actions and apply it to each of the rows it would be a great help and very much appriciated!



        • 1. Re: Can you duplicate actions?
          jasotastic81 Level 3

          Is your table a set size? Can you use JavaScript on your form? Is your form dynamic?


          Ok, I'm going to guess at these things and hope this answers your questions. (I'm guessing "no", "yeah, duh!", and "yes".)


          Make sure your form is dynamic and whatever subform houses the table is able to pagebreak and is flowed.

          Create your table with one header row and one other row.

          in that other row, add your drop down list in the first column and textfields in the others.

          In the 'exit' event add the following code:

               var rowNum = this.parent.instanceManager.count - 1;

               if (!this.isNull && this.parent.instanceIndex == rowNum) this.parent.instanceManager.addInstance();



                         this.parent.tfDescription.rawValue = "Description of PN01";

                         this.parent.tfUnitPrice = "15.00";



                         this.parent.tfDescription.rawValue = "Description of PN02";

                         this.parent.tfUnitPrice = "5.00";



                                this.parent.tfDescription.rawValue = "Description of PN03";

                                this.parent.tfUnitPrice = "25.00";


                    //etc. for each PN



          Of course, I don't know your prices, so I'm just guessing those and the variable names. Since you aren't adding product serial numbers, they should be strings. Make sure you put "quotes" around them in the case( ): lines


          This code will automatically be added to each line in the table, and the table will add rows for you automatically. It will not add rows if the client is changing his/her selection. It will also not remove a line if the user decides to remove that choice. You can add a button for that if you'd like.