Validate repeating subform(Instances)

How I can validate a repeating subform(includes 3 required Textfields) for missing data
when the user clicks a email button?
Thanks

Hi,
Well getting the script to change the first instance at least shows that the relative references are correct.
Basically if you are using JavaScript then you would need a loop to work through all of the instances. Lets say the repeating subform is called "repeatSubform" and the hidden subform is called "hiddenSubform".
Then something close to this should work:
var oSubform = xfa.resolveNodes("page1.repeatSubform[*].hiddenSubform");
for (var i=0; i<oSubform; i++) {
     oSubform.presence = "visible";
There is a discussion here on references and resolving nodes: http://assure.ly/kUP02y.
Good luck,
Niall

Similar Messages

  • How to remove all instance in a repeatable subform (bis)

    Hi Niall,
    A few years ago, you helped a user who asked "How to remove all instance in a repeatable subform". Please could you do again with approximately the same problem ?
    In a click event, I have the script "_CarteEN.addInstance();". Well ! Many cards appear. To protect them, I put above a mask (it's a button with a background Fill). Now, how can I do to remove all masks with only one click using the resetdata or anything else...
    I try this but it doesn't work.
    while (flowedSubform.CarteEN._CacheCV.count > 2)
         flowedSubform.CarteEN._CacheCV.removeInstance(1);
    Many thanks for your help !

    There is no subform named "flowedSubform"
    The "CacheCV" is not a container object (subform). so you can't access the instanceManger of this object.
    the below lines should work
    while(_CarteEN.count >1)
         _CarteEN.removeInstance(1);
    Nith

  • I'm trying to set the value of a textfield to a instance of another textfield in a repeating subform

    Hello all,
    I am trying set the value of a textfield in a repeating subform/table row to another textfield in a repeating subform with the corrosponding instance number.
    The user enters a list of Key Activities in the first part: -- KeyActivityRow is the repeating subform --
    xfa.resolveNode("form1.#subform.KeyActivities.Row1.Table2.KeyActivityRow.Cell2")
    -- KeyActivityRow is the repeating subform --
    Which then Populates the corresponding occurence of:  --
    xfa.resolveNode("form1.#subform.ActivityTable.HeaderRow.Table1.HeaderRow.Cell1")
    -- ActivityTable is the repeating subform --
    Kevin

    In the calculate event of form1.#subform.ActivityTable.HeaderRow.Table1.HeaderR ow.Cell1 enter this script in Language:JavaScript :
    this.rawValue=xfa.resolveNode("form1.#subform.KeyActivities.Row1.Table2.KeyActivityRow["+A ctivityTable.index+"].Cell2").rawValue
    Kyle

  • Multiple repeating SubForms binding to the same data node

    Having multiple repeating SubForms binding to the same data node : In our documents, many times we need to display information from same table in multiple locations. For example, if document displays information of Insureds on one page and information of drivers on another page, we need to create a LiveCycle document with two SubForms. Each SubForm needs to have a repeating binding to CommonInsured element in XSD.  LiveCycle Designer is not able to handle such case. We cannot have two subforms bound to the same node, ONLY in a case where repeating option is selected for data binding.
    The only way I have found out is the following Javascript
    //Get the data node from XML. You will find the code for this function in //JavaHelperFunctions library.
    // InsuredDataRepeatingSubForm is a second subform.
    //You need to manually add instances to this subform at the
    //runtime and Insured data to each instance.
    var insuArray = JavaHelperFunctions.getInsureds();
        var i=0;
        for( i=0; i<insuArray.length; i++)
           if (i>0)
    var thesubform = this.InsuredDataRepeatingSubForm.instanceManager.addInstance(i);
                  thesubform.InsuredName.rawValue = insuArray[i].fullName.value;
           else
                   this.InsuredDataRepeatingSubForm.InsuredName.rawValue = insuArray[i].fullName.value;
    Is there any way I can achieve directly using bindings since we are trying to minimize javascript that changes the layout of the form?
    Thanks in advance!

    Unfortunately not. I've spent countless hours/days trying to do the same thing. You have to use code. The form consumes all the data it can into the repeating elements until there is none left and it is not reused.
    Here's a function I wrote just for that purpose. Feel free to use it:
    function loadData(source,target){
    target.setInstances(source.count);//set the target's subform instances to match the source's
    for (var a=0;a<source.count;a++){//loop through each subform instance
      var sourceSubform=source.resolveNode(source.name.substr(1)).all.item(a);
      var targetSubform=target.resolveNode(target.name.substr(1)).all.item(a);
      for (var b=0;b<sourceSubform.nodes.length;b++){//loop through the children of each
       if (sourceSubform.nodes.item(b).className=="field" && targetSubform.resolveNode(sourceSubform.nodes.item(b).name)!=null)//check for matching fields
        if (typeof(targetSubform.resolveNode(sourceSubform.nodes.item(b).name).value.exData)=="undefined" ||
         typeof(targetSubform.resolveNode(sourceSubform.nodes.item(b).name).value.exData.body)=="undefined")
         targetSubform.resolveNode(sourceSubform.nodes.item(b).name).rawValue=sourceSubform.nodes.item(b).rawValue;
        else
         targetSubform.resolveNode(sourceSubform.nodes.item(b).name).value.exData.loadXML(sourceSubform.nodes.item(b).value.exData.saveXML(),1,1);
       if (sourceSubform.nodes.item(b).className=="instanceManager" && targetSubform.resolveNode(sourceSubform.nodes.item(b).name)!=null)//check for matching subforms
        loadData(sourceSubform.nodes.item(b),targetSubform.resolveNode(sourceSubform.nodes.item(b).name));
    Just make sure the source and target subform hierarchies are identifal, same name and all. It will recurse down the tree and transfer source fields (rich text and plain) to their sister targets.
    Kyle

  • Passing field data from a repeating subform to another repeating form

    Hi all,
    In my main form, I have a repeating subform which captures various customer demographics. It repeats up to 7 instances based on how many clients are associated to a particular account.
    The form user clicks a button to add new instances then fills in the various fields.
    What I have currently is another hidden subform which I need to then make visible, but I also need one new instance of that form, prefilled with selected fields, for each instance of the first subform.
    I'm not sure how to go about doing this. Based on my searches, it appears I need some sort of script to resolve each node and associate it with the second subform instances but I'm really unclear how to do that.
    Any advice will be greatly appreciated! TIA

    Hi all,
    I thought I found what I was looking for but still having problems getting it to work. Found this example on John Brinkman's blog...
    var srcFields = Subform1.resolveNodes("$.#field[*]");
    for (var i = 0; i < srcFields.length; i++) {
      var fieldName = srcFields.item(i).name;
      // if the same-named field exists in S2…
      if (Subform2.nodes.namedItem(fieldName)) {
         Subform2[fieldName].rawValue = srcFields.item(i).rawValue;
    I created a simple form containing 2 flowed subforms, each with one text field (same name). I added a button to subform1 to add one instance of subform1 on each click. I placed the script above in the change event of the text field in subform1.
    Nothing is happening at all in subform2. I can add my 3 instances, enter a name in the text field but nothing shows up in the text field of subform2.
    Can anyone offer any suggestions? Very new to this stuff so I'm really at a standstill. TIA!

  • Assigning values to repeating subforms using a script

    I am using a script to add values to a repeating subform. Below is a simple example. In the real script I would use a loop to do the inserts.
    //declare XML structure
    String hrxdproot = /process_data/hrxfaform/object/data/xdp/datasets/data/form1";
    //assigning repeating subform number
    int i = 1;
    //assign a value to the first repeating subform
    patExecContext.setProcessDataStringValue(hrxdproot + "/Details[" + i +"]/employee_name", "Aditya");
    However, the error I get is
    "Target exception: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. "
    I also tried to use a SetValue module to perform the same function and got the above error.
    /process_data/hrxfaform/object/data/xdp/datasets/data/form1/Details[1]/employee_name = "Aditya"
    Finally, I manually merged a sample xml (with 2 instances of the repeating subform) with the pdf and it worked fine. So I don't think there is a problem in the XML.
    Can someone please help...
    Aditya

    But the question is wether or not you're going to dynamically add nodes to your structure. Even if the schema permits to have multiple nodes under a specific section, it's hard to use xPath to do that. For example if you have a structure like the following:
    <Root>
      <Node1/>
    </Root>
    and use the following xPath /process_data/xmlvar/Root/Node1/Child1, you're going to end up with the following:
    <Root>
      <Node1>
          <Child1>
       </Node1>
    </Root>
    Now if you try to add another node under child node with a similar xPath /process_data/xmlvar/Root/Node1/Child2, you're going to end up with the following:
    <Root>
      <Node1>
          <Child2>
       </Node1>
    </Root>
    It won't append the node, it will replace everything under Node 1.
    So if this is what you're trying to do (add multiple children nodes), then you would have to create the xml structure using standard DOM objects within a custom component or the script service and the set the resulted xml to an xml variable.
    I hope this clears thigns up.
    Jasmin

  • Schema binding, add new subform instance

    I'm creating a fairly simple form which has an unknown amount of grouped entries. I made a data connection to my schema and used "Generate Fields" to bring the fields into the document bound to the schema.
    If I do this multiple times using each instance as a subform I can get a nice xml doc out of it ripe for digestion like so:
    <root>
         <entry>
              <data1>
              <data2>
              <data3>
         </entry>
         <entry>
              <data1>
              <data2>
              <data3>
         </entry>
    </root>
    However, I don't know how many entries the client will be adding so I want to have a button that adds a new instance of the bound data as done manually before. I have been able to prove the concept with a static subform using _Subform1.addInstance(1) on a button.
    When I try to apply it to the bound data subform, nothing happens, no error, no new instance. Also the Repeat Subform for Each Data Item area is greyed out in the Object Binding for the Schema-ed subform.
    Does anyone have an idea about what's going wrong here?
    Thanks in advance,
    Kevin

    Few things to check here.
    1) The parent subform needs to be set to Flowed. Then you should get the Repeat Subform for Each Data Item enabled for you.
    2) The form should be saved as dynamic.
    Let me know if you still have issues. If so, send the form to [email protected] so I can have a look at it..
    Thanks
    Srini

  • Repeating subforms issue

    I am trying to add a repeating subform, but the page ends right after the first instance. So, when I preview and add another instance of the subform, most of the content is not getting displayed. Can anyone please help? I pasted this subform on a new page and it did, indeed, add new subforms. However, when the page ends, so does the ability to have more instances of the subform.
    A second issue is that the button to subtract added subforms does not show up when I add a new subform from the preview. I have checked the code. I used the buttons from the PurchaseOrder.xdp sample. Thanks for any hints!
    Suzanne

    Thanks, Stephen!
    I do have my subform wrapped in a flowed parent subform and have the allow pagebreaks box checked. It just isn't working.
    I don't know how to fix that code. For the add button (which works), I have the following:
    form1.ConnectorInfo.FlowedSF.PropOptionsSF.Button2::click - (JavaScript, client)
    // Get the instance manager.
    var oManager = this.resolveNode("PropOptionsSF").instanceManager;
    // Invoke the Instance Manager to add one instance of the detail subform.
    var oNewInstance = oManager.addInstance(1);
    // Invoke the Instance Manager to insert the subform below the current one.
    var nIndexFrom = oNewInstance.index;
    var nIndexTo = this.parent.index + 1;
    oManager.moveInstance(nIndexFrom, nIndexTo);
    For the subtract button, which never appears, I have the following:
    form1.ConnectorInfo.FlowedSF.PropOptionsSF.Button1::click - (JavaScript, client)
    // Get the instance manager.
    var oManager = this.resolveNode("PropOptionsSF").instanceManager;
    // Invoke the Instance Manager to remove the current instance of the detail subform.
    this.resolveNode("PropOptionsSF").instanceManager.removeInstance(this.parent.index);
    See any obvious problems here?
    Thanks again!
    Suzanne

  • Repeating subforms written out of sequence in XML submission

    I have a form with a repeating subform that I am submitting as XML. The problem I'm seeing is that the XML elements for the 2nd thru N occurrences of the subform are written out of sequence toward the bottom of the XML. Here's the form structure...
    And here's what I'm seeing in the aubmitted XML, with 3 instances of the repeating subform created...
    Any clues ?

    I don't believe you have any control over this - at runtime, the newly generated instances are appended to what's already in the container. Can you change the process that's working with this file to not depend on them being in a particular arrangement? For example if you're processing with something that supports XPath, ask for all the repeatingSubform children of topSubform and you'll get those three together..
    SteveX
    Adobe Systems

  • Hide Repeating Subform

    I have a nested subform inside a repeating subform (Q1). I would like to be able to click a button and hide all instances of the nested subforms. It is named Subform3.
    I tried this script:
    LPA.FormButtons.HideButtons::click - (JavaScript, client)
    this.resolveNode("Q1[*].Subform3[*]").presence = "hidden";

    Use this if Subform3 has only one instance and if Q1 doesn't need to be specified its index(if it crashes use the second loop)
    for (var i = 0; i < this.resolveNode("Q1").instanceManager.count; i++){
         this.resolveNode("Q1[" + i.toString() + "].Subform3").presence = "hidden";
    Use this if Subform 3 has only one isntance and if Q1 need to be specified its index
    for (var i = 0; i < this.resolveNode("Q1[0]").instanceManager.count; i++){
         this.resolveNode("Q1[" + i.toString() + "].Subform3").presence = "hidden";
    Use this if Subform3 has more than one instance
    for (var i = 0; i < this.resolveNode("Q1[0]").instanceManager.count; i++){
         for (var ii = 0; ii < this.resolveNode("Q1[" + i.toString() + "].Subform3").instanceManager.count; ii++){
              this.resolveNode("Q1[" + i.toString() + "].Subform3").presence = "hidden";

  • Subform Instance Controls: Add Button

    Hello,
    I have a subform that i want to continue repeating when the user clicks on the add button. I would like the minimum to be 0 and when the user clicks on the button it will bring up the first occurrence. The problem is that it is not allowing me to have a minimum of 0, only 1. if i change it to 0 then the subform does not appear when clicking the add button.
    Also, i keep getting an error message when clicking the add button. it says "Date of birth: the birth date must be entered". the message appears about 5 times. I have made the date of birth field in the subform 'optional' as it was previously mandatory, and i have confirmed that there is no other script causing the problem, so im not sure why it isnt working.
    I would greatly appreciate any help that is offered.
    Thank you in advance!
    Nik

    Yes, you can have a subform with its occurrence set as 0 and then added when a user clicks an add button.
    In a simple form I have a button with the following script _Subform1.addInstance();
    There is a subform named SubForm1 that exists and has on the binding tab of the object Repeat Subform for Each Data Item "checked"
    The min, max and initial count are not selected.    This will have it that when the form is rendered there is no instance of 'Subform1' and that when the add button is pressed then 'Subform1' is added once.

  • Need help with repeating Subforms on the next page

    I have created two different flowable repeating subforms, for example - subform1 and subform2 in a document with an action button for each to add another subform on the next page.  After subform2, I have two buttons - one to add subform1 again or add subform2 on the next page. When I click the button, Livecycle adds the new subform as commanded but the subform is added directly after the previous same subform not on the next page as requested.  I have tried to change the pagination settings but nothing seems to work.  Can anyone help me define how to get the repeating subform to add to the next page and not after the same subform?

    OK, so here's what I would do.
    1. Wrap your subform1 and subform2 in a subform. I'll call it sfMaster.
    2. Change your minimum instance for subform1 and 2 to 0 or uncheck the box, and set the initial count to 1. (That way you get at least one of each when we start.)
    3. have the buttons create a new instance of sfMaster, then remove the instance of the subform you didn't want within that most recent instance.
    So, what the user sees is a new subform1 or 2 each time they hit a button. And they'll appear in whatever order they choose it. The user doesn't have to know that what is actually happening is the creation of a new "master" subform that holds both subform1 and 2.
    To help illustrate what I mean, I've added a pink border around sfMaster and colored subform1 and 2.
    Binding options for Subform2 (Subform1 would be similar)
    What it looks like in action
    If you want to guarantee it appears on the next page, you'll need to add the conditional break from earlier. Keep working with it to get the settings just right. You may even want a docReady() event that creates two sfMaster's and sets one to have Subform1 and the other to have Subform2.

  • Create a secondary calculation in a repeating subform based on a drop-down list?

    Hi all,
    I need a crazy bit of scripting. Not sure it's even possible.
              What I have:
    repeating subform SummarySub with dollar amountcalculation field at end of form TotalOver gives total dollar amount from all iterations of SummarySub
    so far, so simple. but then:
    I need another, repeating subform SubRow at the end of the form to give another total:
    based on Payer Name drop-down list in SummarySub
    and break out totals from all iterations of SummarySub based on payer names as chosen by the user.
    Ideally, the subform (B) (Payer Totals) at the end of the form would add instances as the user exits the Payer Name field. I haven't been able to figure out how to do that and keep the value in the (Payer Name) field of the added instance.
    Does any of this make sense?
    I'll appreciate any help.  I'm trying to learn more about JavaScript in LC, but my deadlines just keep coming....
    Many thanks
    Laura
    Dropbox - AFBS_OverpaymentReport_121914.pdf

    Hi Laura,
    You are right with the need for the nested for loop, If add this code to the calculation event.
        var nTotalRemitted = 0;
        var oAmountsRemitted = item.resolveNodes("SubRowtwo[*]");
        var nRemittedLength = item._SubRowtwo.count;
        for (nRemittedCount = 0; nRemittedCount < nRemittedLength; nRemittedCount++)
            var oRemittedItem = oAmountsRemitted.item(nRemittedCount);
            var nAmountRemitted = parseFloat(oRemittedItem.AmountRemitted.rawValue);
            if (!isNaN(nAmountRemitted))
                nTotalRemitted += parseFloat(oRemittedItem.AmountRemitted.rawValue);
    see the sample https://sites.google.com/site/livecycledesignercookbooks/home/AFBS_PTM_bruce%20script_TEST .pdf?attredirects=0&d=1
    There are some comments in the sample explaining some of the code
    Regards
    Bruce

  • Repeating Subforms after applying Usage Rights

    Hi Guys,
    I've been going crazy trying to get this problem solved over the last couple of weeks. I unfortunately can't post the PDF due to privacy issues, but I'm hoping you might be able to point me in the right direction for what might be causing the issue.
    The Problem
    We're running into a problem once the LiveCycle PDF is opened in Acrobat Pro and has Usage Rights enabled. Once we save the PDF, then re-open it, the repeating subforms start misbehaving. For example, when we re-open that document, rather than the subform having 1 instance (as it should be default), it opens with multiple instances of 2, 3, 6 or 20).
    This issue only occurs once Usage Rights have been enabled on the document, and it's always the same number of instances being repeated.
    Document Details
    The PDF document was created in Indesign then imported into LiveCycle to apply the interactivity. There are a total of 17 pages
    There are several subforms throughout the file on various pages. Each of these subforms has a button below them which allows the user to add additional instances of the subform (using the built-in script that LiveCycle generates). Each subform has a minimum count of 1 and maximum limit set to 20. The "initial count" has been set to 1, but it appears LiveCycle removes this value if it is the same as the minimum count.
    This document does not tie into any database. It is simply an interactive document that allows users to show/hide pages based on the checkboxes they tick on the first page (just changes page visibility). The idea being, the customer can save the form once they've completed the fields required, then email it back, so save functionality is a requirement (which is why we need Usage Rights).
    What I've Tried So Far
    I've done a lot of reading on the subject, and I've seen people mention that subforms with non-unique names or empty subforms can cause the issue. I've checked through the document and all subforms have a unique name and there are no empty sub forms.
    As a way to trying to narrow down which elements might be causing the issue, I resorted to deleting multiple pages from the document to track down a specific element that might be causing the issue, however, i didn't have much luck with this. The removal of the majority of pages other than the single repeating subform resulted in the subform repeating itself 6-8 times (can't remember specifically, but it previously repeated itself 20 times)
    Any Ideas?
    I know it's a bit difficult without being able to see the document directly, however I'm hoping someone might have a suggestion for anything I may have overlooked. Is it simply Usage Rights screwing things up, or is there potentially something in my code that conflicts with the usage rights. The thing I find most confusing about this scenario is the apparently randomness for how many instances show up. The first subform pre-loads with the maximum limit available, but the rest of the forms most load with only 2 instances (when they also have a max limit of 20 items).
    I've read a few forums where people suggested Reader Extensions, however according to Adobe's system requirements it doesn't seem to match what we're trying to achieve. There is not database interaction at all - we only require the ability of users to save the PDF locally.
    If anyone can offer suggestions for where I might need to look to sort the issue out, I'd be most appreciative. Thanks!

    Hi,
    Your description of the problem is very detailed. Send me a private message if it is possible to send the form to an individual instead of posting it publicly.
    Here is a thread on repeating subforms, that may help: Saving finished Form duplicates some subForms I used a console.println line of script to try and help identify the problem.
    I would try and minimise the number of flowed subforms and only use them where they are required for the contents of that subform. In all other cases use positioned subforms.
    Minimum count only serves a purpose when you have a button that allows a user to delete instances. A minimum count of 1 means that the user can delete instances, but not the last remaining instance. Unless you need this, you could take this out.
    I don't think the problem is because the form is enabled. There must be something else going on in the background.
    Try opening the Javascript Console in Acrobat/Reader (pressing Control+J) and see if any warnings/errors come up. Also put in a console.println script to display the nodes in the console.
    Good luck,
    Niall

  • Populating Text Field from Dropdown in Repeating Subforms

    Hi there,
    I'm trying to create a dropdown in a repeating subform that populates a text field in the same subform depending on the option selected.
    I used the functionality described here to acheive the text field population in the first row, but I have trouble when I add additional instances of my subform. In subsequent instances, when I select an option from the dropdown, it changes the text in my first textbox and does not populate anything in the repeated textbox.
    I'm not sure how to get this to work for each added instance and/or how to keep each instance separate from one another.
    Thanks in advance for your help!

    Can you repost the question - some funny formatting issue

Maybe you are looking for

  • My Wife and Ishare the same iMac, as different users, with separate iTunes accounts. How can I share some of my playlists with her iPod?

    When I go to sync her ipod to my account, Itunes wants to remove all her tunes, before it will install the ones she wants from mine. She wants to keep what she already has on it. How can we do this?

  • How do I save a photo from a text to camera roll

    How do I save a photo from a text message to the camera roll?

  • My iphone will not wifi sync

    Im trying to get my iphone 5 to wifi sync with my macbook pro but its not doing it I have tried everything i can think of: -iphone is plugged in -itunes is open -itunes(when phone was plugged in) is checked for wifi sync -the apple ID's are the same

  • I facetime

    yep, i know that not big trouble for you guy but not my family or wife. Since my wife update my mac in to YOSEMETE 10.10 that's have been bring so many troubles. the most important is iface time, i am working far away from her then the only thing kee

  • TR was not created after MIGO

    Hi, experts Sometimes after I did goods receipt with MIGO for purchsing order, the TR was not created by system. Normally after MIGO system create material document and TR at same time, then I use LT06 with reference the document no. place it to the