Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Page-Breaks for Expanding Subforms

Avatar

Level 2

Hello,

I've got a new Training Rquest Form that I'm designing. I'm having a bit of trouble though as I was hoping that I would be able to get the expanding parts of my form to go over to the next page. I've created the form to be dynamic so that you can click a button which uses the instance manager to create another subform. So, you would have something like : "Add Teacher" which adds a new line in which you can input the information about the teacher.

I've also got it set up so that by pressing a button, an entirely new section will appear to enter more information. The problem comes when I try and create another of these and it goes off of the page. It SHOULD be going to the next page but I can't figure out why it isn't. I've checked all of the options and as far as I can see, everything allows page breaks, the subforms seem to be working and really at this point I just need someone else to take a look at it.

I could make the form so that it makes a new page visible that I've already made but I would much rather do this the correct way rather than the lazy way of just copy-pasting.

If anyone is interested in helping me out, let me know and I'll email the form to you since I guess you can't add files here and the section I need looking at is several hundred lines of XML so that's no good either. (using LC version 8.2 by the way)

On an unrelated note, I've noticed that I'm getting repeated lines in my forms in the XML. This issue has actually caused some of my forms to be so bloated that I can no longer open the XML tab because LC crashes. I realize that this is a problem with version 8.2 that they've fixed for 9 but I don't have version 9 and I'm not about to buy it just for this problem. So if anyone knows what exactly causes this copying of the XML lines, please let me know so I can try to avoid that.

The lines that I see copied most often look like this:

<?templateDesigner StyleID aped3?>

They're always template files. I think it might be somehow related to copy-pasting from my testing? Anyway, any help would be appreciated on either problem. Thanks everyone!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The problem you describe is a bug in the product and is caused by copy and pasting content. This is solved by upgrading to a new version of the Designer. you woudl simply open the file in that Designer and the file woudl automatically be cleaned up. So if you want to stay on that version you will have no choice but to live with the repeated lines issue.

The new issue is because you have defined the field as a TextField so it is adding the string 1 with ahatever else you are passing through .....as you pointed out ..making it Numeric allows you to do Math addition instead of string addition.

paul

View solution in original post

8 Replies

Avatar

Former Community Member

To make something flow across page boundries the root container must be set to flowed. My guess is that your Page level subform is positioned and that is stopping a new page from appearing. It is not as simple as changing the page subform to flowed as all content will be placed top to bottom and left justified. So make sure that you put your content into Positioned subforms that extend to th ewidth of th epage so that when you do change the page to flowed that the Positioned subforms will be placed top to bottom and left justified and your content will not move. You may find it best to create different sections of the form for each subform (Header Body, Footer)

For the reeating StyleID issue ..you are right it is the copy paste which is causing it. If you send me the form I will run it through a cleaning process and get rid of those lines. Send the form to LiveCyle8@gmail.com ...it woudl be best to send the XDP version of the form (file saveAS XDP file)

Hope that helps

Paul

Avatar

Level 2

Yes that worked! That was very helpful.

As for the other issue, I was hoping more for an explaination of why it happens so that I can avoid it in the future. It's not really ideal for my co-workers to have to send their forms to Adobe all of the time and it's wasting your time.

If I can stop the problem before it happens, that would be better and we'll be able to just avoid the problem for the most part.

I'd also like to ask about a script that I've been trying to get work (I know I've got a lot of questions but I figure since I'm here anyway...) I'm basically trying to keep track of the number of Sessions, Dates, Intructors, etc. that the user has on the document (by them clicking the expand buttons). I've been trying to do this by using a hidden text field and changing the value. This works with things that have specific responses because I'll know what number it is, I can just say something like Textfield1 = 1

I can't seem to add onto it though. I'm not sure what the problem is, here's the script (in Javascript):

HiddenValueInst.rawValue = HiddenValueInst.rawValue +1;

This ends up simply adding a "1" to whatever is in my hidden Value field. Is there a different syntax that I can use for this? Should it maybe be a text-only field? I haven't been able to figure out how to access the instance number from the Instance Manager but if you know how to do that, it would be helpful as well.

Thanks for the help so far.

Edit- Nevermind, it looks like switching it to a numeric field fixed the problem. I don't know why I didn't think of that before.

Avatar

Correct answer by
Former Community Member

The problem you describe is a bug in the product and is caused by copy and pasting content. This is solved by upgrading to a new version of the Designer. you woudl simply open the file in that Designer and the file woudl automatically be cleaned up. So if you want to stay on that version you will have no choice but to live with the repeated lines issue.

The new issue is because you have defined the field as a TextField so it is adding the string 1 with ahatever else you are passing through .....as you pointed out ..making it Numeric allows you to do Math addition instead of string addition.

paul

Avatar

Level 2

Alright, that answers my questions. Thanks. Though, now I have another question (as I said, they've been building up lately). How can I access a particular instance of a repeated field?

For example, lets say that I'm trying to number each teacher that people add to the form described above. The person types the teacher's name, clicks the "Add Teacher" button which generates another line. How would I get the second line to be numbered "2" rather than "1" ?

I've been trying something along these lines:

xfa.resolveNode("form1.page2.SessionAdd.beneficiaries2.beneficiary2.FlowedSub.BottomSessionSub.DateAdd.beneficiaries2.beneficiary2.DateNum[TopSessionSub.HiddenValueDate.rawValue]").rawValue = TopSessionSub.HiddenValueDate.rawValue +1;

 

This is what I want it to do:

Teacher Number = number of times the "Date" button has been clicked +1

The problem (I think) is that the brackets "[ ]" don't like the "rawValue" being in there. I'm not sure what syntax I'd be able to use if any to have this work the way I'd like it to. Is it possible to do this (or something similar) in LiveCycle?

Thanks.

Avatar

Former Community Member

Lets take a step back. Each object on the form must have a unique name so it can be identified. The name is not just the name of teh field (in your case Teacher) but the subform that holds it. When you add a new subfrom using the instancemanager.addInstance() you are basically creating copies of that object and the product will use an occurance number (for the repeating part) to get a unique name. So if your Teacher field is in a subform called Faculty then th efield can be addressed by Faculty.Teacher. If no occurance is named then the 1st instance is assumed. The occurance number are indicated by square brackets on the repeating part and the iinstances are 0 based so to get to the 1st instance you woudl use Faculty.Teacher or Faculty[0].Teacher. To get the 2nd instance you woudl use Faculty[1].Teacher ...etc.

Trying to get the number of times a button is clicked is not an easy thing but there is a property on the instance manger that will return how many instances there are of a repeating object. Remember that in our case the repeating part is Faculty so to get how many there are you woudl use Faculty.instanceManager.count (note that this returns a 1 based value).

So now that we know what we want to get how do we access it in code? Using javascript it is important to note that the square brackets are used for array notation so there is a different way to access the field. You can use xfa.resolveNode("string that represents the object"). This is really a search but the fact that I pass it a string can be used for our benefit. So if I wanted to access the last instance Teacher but I did not know how many there were I can use the command:

xfa.resolveNode("Faculty[" + (Faculty.instanceManager.count - 1) + "].Teacher").rawValue

So now lets look at your situation. There are a number of ways to solve this but using what we have learned we can add code to the button that adds the subform. You would add this after the call to add the subform.

for (i=0;i<Faculty.count;i++){

     xfa.resolveNode("Faculty[" + i + "].field that holds the count]").rawValue = i + 1

}

Hope that helps

Paul

Avatar

Level 2

Working from your last response, I've been messing about with dynamically populating a drop-down list. What I've done basically is this:

for (i=1;i<Faculty.count;i++){

     this.addItem(xfa.resolveNode("Faculty[" + (Faculty,instanceManager.count - i) + "].field that holds the count]").rawValue, i);

}

That's in the preOpen script for my drop-down list which is next to some fields that have the classroom and date. I would also like this to be able to dynamically expand by pressing a button. Unfortunately, it doesn't seem to like "i" being the value for the selection and when I switch "i" out for something that does work, my list shows up but no matter what I pick, always selects the first option on the list which is the last one entered in the teacher field.

I know I'm asking a lot of questions here but I'd really like to make this form good and have it working properly. Can you help me with this please oh LiveCycle Guru?

Avatar

Former Community Member

It will be easier if I can see the form .....can you send it to LiveCycle8@gmail.com and include a description of the issue.

paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----