I am a novice at LiveCycle Designer and I am needing to have my form reference a specific value, should it be entered (recognizing key words), by a user in an add instance, at run-time. Can LiveCycle even do this? And I can be more specific with an example if this doesn't make sense. If you can help, I'd very much appreciate it!
I don't understand what you are trying to do, but calling the addInstance() returns the instance of the subform (or row) you have just added. So if I had a repeating subform called Subform1 which contained a text field called TextField1 then I could set the value of that field with.
var newInstance = _Subform1.addInstance();
newInstance.TextField1.rawValue = "some text";
Given a text field you can test if it contains a string with
This will print "match" on the console if TextField1 contains the string "keyword" anywhere within it.
What I don't understand is how you want to use these two pieces of code.
thank you for your reply. I feel I may have to email you more as my terminology and understanding of LiveCycle is new. I have attached screen shots from my form in run-time as well as my hierarchy. My form is really a template for Engineers who will need to fill this out and there will be many cases where the user will need to add additional text fields (add instances) using a click event. Later in the template, I have tables that need to reference the value of text fields within each instance should the value be "critical". However, since the user will be adding instances, I don't know how to reference the value of a new instance at run-time. I can send you more in an email if this doesn't make sense. Thank you for your time and help! I have only taught myself everything with LiveCycle so please be patient if I don't understand conclusions. My apologies in advance. Thanks again!
You should be able to populate the summary table, either in the exit event of Level3 or maybe the calculate event of the summary table, assuming the exit event the code would like something like;
var level1Items = ???.resoleNodes("Designerlevel1[*]")
for (var i = 0; i < level1Items.length; i++)
var level1Item = level1Items.item(i);
var level2Items = level1Item.resoleNodes("DisplayLang[*]")
for (var j = 0; j < level2Items.length; j++)
var level2Item = level2Items.item(j);
var level3Items = level2Item.resoleNodes("Level3[*]")
for (var k = 0; k < level3Items.length; k++)
var level3Item = level3Items.item(k);
if (level3Item.Label.rawValue.indexOf("Critical") === 0)
var newRow = summaryTable.addInstances();
newRow.Number.rawValue = "???"
newRow.Item.rawValue = "???"
I don't really understand your form structure, but hopefully that will head you in the right direction.
I'm happy to look at your form but would prefer if you would post a link to it in this thread, then it may be helpful to others and someone else might be able to help. I probably wont be able to get back to this forum until the weekend.
Thank you for your time and response. I would love to show someone this template ("form") but I can't unfortunately. Its a confidential document within my company. As for the structure of the form, I actually used a template that another Adobe member sent me and expanded on it for my needs. What he sent was this: https://files.acrobat.com/a/preview/535d7c39-766b-418f-9e2a-3a92f808ab54
I've updated the sample to produce a summary table of all lines that start with the word "critical", https://sites.google.com/site/livecycledesignercookbooks/home/Multilevel_Step_Numbering_With_Summary...
Have a look under the calculate event of the Summary object.
Hopefully you can apply the code in your form.