Help with two forms and the rawValue option

orlandoc3327638 20-03-2018

Help with two forms and the rawValue option

Good afternoon at the Forum, I hope can help me.

I have these two forms:

Form1

formulario1.png

Form2

formuilario2.png

When I select option 1 in the Form2:

formulario opcion.png

In the row of the form 1 appears correctly the option that I marked:

formulario opcion2.png

But after you insert a second row in the form 2 which are also automatically inserted into the form 1

and marco option 2 in the form 2:

formulario opcion 2.png

In the second row of the form 1 keeps coming option 1 I marked above:

formulario opcion 2 mal.png

Please someone could help me to make the appropriate correction and thus solve the problem

Thanks a lot.

Kind regards

Orlando

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (7)

Answers (7)

MinusZero 22-03-2018

Hi,

This is the simplest idea to throw the value from the dropdown list in table 2 to the field in table 1.

Try this code out and it might help you understand instance referencing.

Create two tables with 1 row.

Click the row in the hierarchy and then make it repeating for each table

Create a button to add rows

In table 1 put in a numeric field

in table 2 put in a drop down list (configure your values 1-5

1449092_pastedImage_0.png

Add Row Button Click event javascript

this.resolveNode('Table1._Row1').addInstance(1);

if (xfa.host.version < 😎 {

xfa.form.recalculate(1);

}

this.resolveNode('Table2._Row1').addInstance(1);

if (xfa.host.version < 😎 {

xfa.form.recalculate(1);

}

Table2 Drop Down List Exit event javascript

this.resolveNode("Table1.Row1[0].NumericField1").rawValue = this.resolveNode("Table2.Row1[0].DropDownList1").rawValue;

this.resolveNode("Table1.Row1[1].NumericField1").rawValue = this.resolveNode("Table2.Row1[1].DropDownList1").rawValue;

this.resolveNode("Table1.Row1[2].NumericField1").rawValue = this.resolveNode("Table2.Row1[2].DropDownList1").rawValue;

this.resolveNode("Table1.Row1[3].NumericField1").rawValue = this.resolveNode("Table2.Row1[3].DropDownList1").rawValue;

this.resolveNode("Table1.Row1[4].NumericField1").rawValue = this.resolveNode("Table2.Row1[4].DropDownList1").rawValue;

In this example The drop down list references all instances, whether they exist or not, you will see errors in the console because they dont exist, but it doesnt stop it working.

Click to add some rows (the code is only for 5 rows, but you can always add more.

When you select an item in the dropdownlist in table 2, the selected rawValue is sent to the numericField in Table1 to the correct instance (row).

1449094_pastedImage_5.png

MinusZero 21-03-2018

You will need to send the raw value to table 1 based on the repeated instance.

To send the raw value to table 1 based on what is in table 2 use something like this on a click or exit event or some other event. Maybe the exit event of the dropdownlist in table 2 would work well. Using javascript.

//the value in table 1 is the same as the value in table 2.

this.resolveNode("Table1.Row1[0].DropDownList1").rawValue = this.resolveNode("Table2.Row1[0].DropDownList1").rawValue;

Explanation:

You will notice here this: [0]

This refers to the repeated instance number. [0] is the reference for the first row of the table. If you add a second row, the instance to refer to is [1], row 3 is [2] and so on.

Place the instance reference after the repeated row in your syntax. Eg: straight after Row1 -> Row1[2]

I hope this helps

orlandoc3327638 23-03-2018

Good afternoon Dear, very grateful for his help, he left the document link that I am making, please i need a little more help

https://drive.google.com/open?id=13Vzo37kfIwSbtggETi0oBhWyGcdMCSPw

In the table on the second page i have the option type construction that calculates the value of the field (the field score score is the sum of the fields in the table foundations, structure, floors, walls, etc), how should make the code corresponding to that in the typology of the first page out the same result, try to follow the same instruction that recommended me but it does not work, please i need your help. Thank you very much.

Valor.pdf - Google Drive

orlandoc3327638 23-03-2018

Good afternoon Dear, very grateful for his help, he left the document link that I am making, please i need a little more help

https://drive.google.com/open?id=13Vzo37kfIwSbtggETi0oBhWyGcdMCSPw

In the table on the second page i have the option type construction that calculates the value of the field (the field score score is the sum of the fields in the table foundations, structure, floors, walls, etc), how should make the code corresponding to that in the typology of the first page out the same result, try to follow the same instruction that recommended me but it does not work, please i need your help. Thank you very much.

Valor.pdf - Google Drive

orlandoc3327638 22-03-2018

Good morning

Many thanks for your help, but I do not understand how to perform the modification in order for the form to work correctly, it could send the file for review please, I would be very grateful, apologize for my writing, my english is not so good