I'm trying to create a document that has 4 seperate tables in that the user will enter information for various materials. I have created a button to add another row in each of the 4 tables using the following JavaScript code:
frmCredit4._Item.addInstance(1);
frmCredit5._Item.addInstance(1);
frmCredit6._Item.addInstance(1);
frmCredit7._Item.addInstance(1);
xfa.form.recalculate(true);
All of the works fine so far, but I need to have the first column repeat in each of the 4 tables, which is where I get stuck. I tried setting the binding to global, but that makes whatever was entered in the first row of the first table repeat in all of the other rows of all of the tables, which of course won't work because I need different data in each of the rows of the first column. Any suggestions?
Thanks,
Michael
Solved! Go to Solution.
Views
Replies
Total Likes
Your requirement is tricky and very challenging (I like the stuff). Check the attachment here is what I have done.........
1. Set the Binding to Normal
2. Added FormCalc code to the "exit" event of the Table1:Column1:txtMaterialComp
Here is the script
var partLeft
var partRight
partLeft = Substr($.somExpression, 1, 69) //69 is the length of the characters before '5' in the SOMexpression of the field
partRight = Substr($.somExpression, 71, 200) //71 is the starting position for the right part and 200 is to get the chars till the end....or you can have 500
//xfa.host.messageBox(Concat(partLeft,5,partRight))
var transferTo5
transferTo5 = Concat(partLeft,5,partRight," = ", """", $.rawValue, """")
//xfa.host.messageBox(transferTo5)
eval(transferTo5)
This script will dynamically access the instance number and then sets the value in the specified relative field.
Hope you can take it from here and add additional script to populate rest of the tables as you need.
Good luck,
Views
Replies
Total Likes
If I understand your question correctly you want repeating columns. Someone posted a sample of how to do that previously, so I can't take credit for this script, but it works great. See attached.
Views
Replies
Total Likes
Not quite... I should have explained it better. I need to have multiple tables, but the information in the first two columns will be the same in all of the tables. So, I'm looking for a way to repeat that information. The problem that I'm having is that each time the form is filled out, there will be a different number of rows, so I'm using the add instance script to add rows to the table. I need the data in table 1 row 1 column 1 to automatically appear in table 2 row 1 column1 and in table 3 row 1 column 1, etc.
The only way I know how to make data repeat from one text box to another is to use the exact same name for both boxes and set the binding to global, but since add instance is creating new text boxes with the same name as the old boxes, I'm getting the data entered in table 1 row 1 colunm 1 in every row of every table in column 1. I've attached the first two tables of the form in case anyone wants to take a look at it. Is there a way to force it work the way I want it to?
Thanks,
Michael
Views
Replies
Total Likes
Here is the java script I got from another poster to copy information from one field to another
----- F.P1.RequestedBy::exit - (JavaScript, client) ------------------------------------------------
SpecialHandlingSlip.ReturnTo.rawValue=this.rawValue;
Note in the case of my form, the RequestedBy field is a drop down box. On exit, this takes the information entered there and copies it to the ReturnTo field on my special handling slip, which is a subform, but it does not repeat so I'm not sure if it would work for you. Someone more experienced than I may be able to tell you if it works. I'm still learning to create dynamic forms myself, but I have picked up quite a bit from this forum.
Views
Replies
Total Likes
Thanks for the help. I'll give that a try.
Views
Replies
Total Likes
Your requirement is tricky and very challenging (I like the stuff). Check the attachment here is what I have done.........
1. Set the Binding to Normal
2. Added FormCalc code to the "exit" event of the Table1:Column1:txtMaterialComp
Here is the script
var partLeft
var partRight
partLeft = Substr($.somExpression, 1, 69) //69 is the length of the characters before '5' in the SOMexpression of the field
partRight = Substr($.somExpression, 71, 200) //71 is the starting position for the right part and 200 is to get the chars till the end....or you can have 500
//xfa.host.messageBox(Concat(partLeft,5,partRight))
var transferTo5
transferTo5 = Concat(partLeft,5,partRight," = ", """", $.rawValue, """")
//xfa.host.messageBox(transferTo5)
eval(transferTo5)
This script will dynamically access the instance number and then sets the value in the specified relative field.
Hope you can take it from here and add additional script to populate rest of the tables as you need.
Good luck,
Views
Replies
Total Likes
Very cool. I've added that to my sample pool.
Views
Replies
Total Likes
That code was exactly what I was looking for. Thanks Varma!
Views
Replies
Total Likes