I need to figure out how to make the rawValue of a textfield in a table header change when that header is repeated on the next page. I have a table where multiple instances of a row can be added, and it could cause a page break. When this happens, I want to take some information the user will have already entered and change the value of the textfield to that. untitled_2 shows what the first few instances should look like, and untitled_3 shows what I want to show up as the header after a page break (notice the date is the same-that's the information the user enters that I want to transfer to subsequent pages). I'm thinking the script will be in the initialize or layout::ready event and will look something like
if (this is the initial header) {
this.rawValue = "Date";
}
else {
this.rawValue = Body.Date.rawValue;
}
I just can't figure out what should be in the parentheses of the if statement. Anyone have any ideas?
Solved! Go to Solution.
Views
Replies
Total Likes
Interesting ......The cell that holds the titke is a static Text field and that has no events to program against. So I woudl remove the static text from that cell, then add a regular Text Field to the Cell. Make the field protected, so the user cannot type into it. Set a default value to the name that you want to give the column - "Date". Now you have events that you can program against. On the Doc Ready event use this code:
if
(xfa.layout.page(this) == 2){
this.rawValue
= DateFieldName.rawValue
}
If the field is on the 2nd page then the value of the column header will change to the value of the DateFieldName field.
Paul
Views
Replies
Total Likes
Interesting ......The cell that holds the titke is a static Text field and that has no events to program against. So I woudl remove the static text from that cell, then add a regular Text Field to the Cell. Make the field protected, so the user cannot type into it. Set a default value to the name that you want to give the column - "Date". Now you have events that you can program against. On the Doc Ready event use this code:
if
(xfa.layout.page(this) == 2){
this.rawValue
= DateFieldName.rawValue
}
If the field is on the 2nd page then the value of the column header will change to the value of the DateFieldName field.
Paul
Views
Replies
Total Likes
Thanks Paul! I was able to adapt your suggestion, and I have the basics figured out. Quick questions-I'd like to format the date that comes out on the second page the same way I have it formatted in DateFieldName rather than the default way, which is YYYY-MM-DD, but when I try to use the picture code date{M/D/YYYY} it gives me an error, because I'm trying to use a date picture code in a text field. How do I work around this? Second, when I first tried this I set the text field's access to "readOnly", then, incorrectly thinking that was causing my problems, changed it to "protected". They seem to work the same, so what's the difference between the two? I can't find any explanation of it in Designer Help.
Views
Replies
Total Likes
For the 1st problem make it a Date field amd your picture clause will work.
For the 2nd - If you do a serach for readOnly in the Help it explains in the access property what all of th eoptions mean. Basically, th euser can copy and paste a value from a readOnly field but they cannot from a protected field.
Paul
Thanks! At first I didn't think making it a Date/Time Field would work because I didn't think you could put anything but dates and times in it, but I guess you can use it like a regular text field! Of course, it yells at you because your text can't be formatted like a date the way the picture code is telling it to, but that's a small price to pay.
Views
Replies
Total Likes
Views
Likes
Replies