on 08-18-2013 6:03 PM
Hi Experts,
I have a requirement wherein I need to populate values in my Table row depending upon the value of another text field.
The problem is when I use this line of code var rsize = xfa.resolvenode("MyForm.SubForm1.Table1.Row1[*].UOM") in the change event of say Field1, it returns 0 on accessing rsize.length whereas the same line returns 5 which is the desired value on initialize event of Table1.Row1.UOM.
How to get this thing working? I need to use similar lines of code in 5 fields i.e. need to access and assign values to table rows dependimg upon change events in 5 different fields.
I am new to Adobe forms and stuck up with this since a long time. Let me know what is the ideal way to get this thing working. And where do I put my javascript code if the dependency to fill the row values is on some other field.
Thanks a lot in advance.
Hello Archana,
Since you want to modify table data of 5 fields depending on their corresponding 5 different text fields, I can provide you two simple approaches.
1st case - You are displaying these corresponding different text fields in the layout (PDF). ---- Follow 1st approach
2nd case - You are not displaying these corresponding different text fields in the layout (PDF). ---- Follow 2nd approach
1st approach
In the form layout, select the field in the table and in the event READY LAYOUT write the below JavaScript code.
Note - If there are N records in the table, this event will be triggered N times. So you can directly map the corresponding text field value and assign it in your table field.
var currpage = xfa.layout.page(this);-------------Get the current page
var fields = 0;-------------Variable to store the number of fields in that page.
fields = xfa.layout.pageContent(currpage-1, "field", 0);-------------Get the number of fields
for ( i=0; i<= fields.length-1; i++ )-------------Loop on each field on the page
{
if ( fields.name == "TEXT_FIELD1" ) -------------Check if the corresponding field is in the layout
{
this.rawValue = fields.item(i).rawValue;-------------Assign that value in the table field
}
}
Repeat the same steps for other 4 fields of the table.
2nd approach
If in case, you are not showing these 5 different text fields in the layout, then drag these 5 different text fields inside the DATA sub form of the table and hide these 5 different text fields. Then on the DATA sub form of the table write the Javascript code. Example is shown below.
this.tablefield1.rawvalue = this.textfield1.rawvalue;
this.tablefield2.rawvalue = this.textfield2.rawvalue;
this.tablefield3.rawvalue = this.textfield3.rawvalue;
this.tablefield4.rawvalue = this.textfield4.rawvalue;
this.tablefield5.rawvalue = this.textfield5.rawvalue;
Note that you can also use the 2nd approach in the 1st case. I think unless its an interactive form and its a 1st case you have to use 1st approach.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.