I am in the process of creating an interactive form that has a button that add rows for the user to input issues and another button to add follow-ups to those instances. There are 3 different sets of these. However, we do not want to add a delete button to all rows, to allow for accidental deletion of already inputted data. I would like to create a button that will delete all empty rows, including all subforms. Either that, or upon saving the document, all empty rows would be deleted - whichever would be easier. Please help! This seems like it will be a complicated task and I am not that well versed in LiveCycle to be able to figure this out on my own.
Thank you!
Solved! Go to Solution.
Views
Replies
Total Likes
In the Object > Binding palette. I have included a screenshot on the forum.
Niall
Views
Replies
Total Likes
Hi,
Here is an example that might help you: https://acrobat.com/#d=hkeDKn6SRo1FAvFUoY6Smw
The first print button lops through the repeating rows and hides the rows where the checkbox is not ticked. This option might give you some ideas.
The second print button agains loops through, but copies non-null data to another table.
Good luck,
Niall
Views
Replies
Total Likes
Ah thank you so much for your help, but I'm still having alot of trouble with this! I think it might be because I'm not entirely familiar with LiveCycle's language. If I sent you the file would you by any chance mind taking a look and tell me what I'm doing wrong?!
Views
Replies
Total Likes
It can be tricky. Can you upload your form to a file sharing site, like Acrobat.com and share the published URL here?
N.
Views
Replies
Total Likes
I took alot of stuff out and left the basics of what I need help with (don't know if my company will like me sharing the form).
http://www.sendspace.com/file/oebzr8
It can be downloaded from there. I also can't seem to figure out why when you add too many statements and follow-ups the title jumps to the next page. Any way to have the title be on all pages it's child statements occur on??
Thank you so much!
Views
Replies
Total Likes
I just realized I defined the wrong function (I deleted some stuff I tried earlier and left that) in the file I just sent, but I just fixed it to be the proper name (I think) and it still doesn't work.
Views
Replies
Total Likes
Hi,
If you edit your post, you can delete the URL/link.
N.
Views
Replies
Total Likes
Hi,
The script you want is:
// count the number of rows
var nCount = ObjectivesSubform.TechnicalHighlights._Row1.count;
// loop through the rows
for (var i=0; i<nCount; i++)
{
if (xfa.resolveNode("ObjectivesSubform.TechnicalHighlights.Row1[" + i + "]").Cell2.rawValue == null)
{
ObjectivesSubform.TechnicalHighlights._Row1.removeInstance(i);
}
// recount nCount in case a row has been deleted
var nCount = ObjectivesSubform.TechnicalHighlights._Row1.count;
}
This loops through each instance of the repeating row and deletes it if the textfield is null.
Normally you would not need to count the number of instances INSIDE the loop, but this is necessary as rows may have been deleted.
Here is the form: https://acrobat.com/#d=XHoH91NWu*1L-YRYrS-tsQ (I will delete it in an hour, for confidentiality).
Last point, in the add row button you have put in some additional script, which did not make sense and was causing a problem. I have commented this out.
Hope that helps,
Niall
Views
Replies
Total Likes
Thank you so much! I don't have access to a computer right now so you don't
have to take it down. I took out all of our info.
Is the added code that you took out the reason why the title is jumping to
the next page when several instances have been added?
Views
Replies
Total Likes
Ahh it looks like you already took it down! Would you mind putting it back
up I didn't get a chance to download. Thank you!!!
Views
Replies
Total Likes
Views
Replies
Total Likes
Oops thanks! If you add alot of rows the heading still jumps to the next
page. Is there anyway that I can specify that I want the heading to be on
both pages if the number of statements spills over?
Views
Replies
Total Likes
Hi,
I have updated the form here: https://acrobat.com/#d=XHoH91NWu*1L-YRYrS-tsQ
There is an option if you select the Header Row, to have it repeat on every subsequent page (see Object > Pagination palette):
The script in the delete button, seems to lose count because rows are being deleted. It's not too bad if there are only a few rows, but if there are a lot of rows, the delete button needs to be clicked a few times. There isn't an error showing up in the console.
Niall
Views
Replies
Total Likes
Would maybe a loop kind of function fix that instead of a for?
Ok, I promise this is the last time I'm going to bother you - this delete
button is over my head. I figured if you did one for me I'd be able to
replicate it but it seems that the other rows are a bit more complicated
because of the way they are set up. I tried to copy your script for the
rest of the lines to the best of my ability but it's obviously not working
properly. I got the technical vital statement rows to delete, but they
would only delete if the technical highlights section had rows to delete as
well. Now I tried to add the follow-up statements in there and now it's not
working at all! AHHH this is so frustrating!
Also, when it deletes rows the ID stays at 2 and 4, etc. If you don't have
time to be bothered with this I understand but I genuinely appreciate your
help! Like I said I think I'm in over my head here!
The link for the file that I've managed to mess up again is
Views
Replies
Total Likes
I am out today, but I think the for loop working from the last row instead of the first will work better. I'll check tomorrow.
N.
Views
Replies
Total Likes
Okay, no problem. Thanks for your time
Views
Replies
Total Likes
Okay, I think I have it as you want the form to behave.
https://acrobat.com/#d=uO-gkfpqn5j3mRIkL1jbCQ
A couple of things:
In relation to the delete rows, I added a line to subtract one from the count, to take into account if a row was deleted.
Hope that helps,
Niall
Views
Replies
Total Likes
Okay, so I have literally copied and pasted the code you provided in the last form, to my full form, and the only one that it is working for is the first table. I've literally gone line by line at least 5 times and compared the code in my form to the code in your form, and it seems to all be the same. I have no idea what I am doing wrong and this is so frustrating! Is there some setting that I'm missing or something???
I also would like to keep the original line in there when it deletes all the subsequent added lines if possible. Even if it is blank. I also need to add something that deletes the blank follow-ups but first I need to get any of it to work.
http://www.sendspace.com/file/bdri5s
I am so sorry for being such a pain!
Views
Replies
Total Likes
Hi,
Here is the form: https://acrobat.com/#d=E0eMdfxZU9J9NMhIjFp0Tw
The main issue is that the repeating object 'instance1' needs to be set to an initial count of '1' and un-tick minimum count. This allows all blank rows to be deleted. Otherwise the script falls over at the first table.
Also watch out for naming variables that are may be reserved words, like 'h'.
Hope that helps,
Niall
Views
Replies
Total Likes
Where do I set this so I know for next time? Not in the code right?.. is
there a drop down menu that I can't seem to find?
Views
Replies
Total Likes
In the Object > Binding palette. I have included a screenshot on the forum.
Niall
Views
Replies
Total Likes
Views
Likes
Replies