Expand my Community achievements bar.

How I can do text fields correlates?

Avatar

Former Community Member
Hi, I've a document whith text field A and text field B.

I want to show the same value of A on B.. I've to write a Javascript code?
3 Replies

Avatar

Level 5
Use the following javascript code if they are in the same subform... You can also use even if there are no subforms...<br /><br />This code can be used in multiple events but may suite your situation on 'exit' event of TextFieldA.<br /><br />this.parent.<fieldname>.rawValue = this.rawValue;<br /> example: this.parent.TextFieldB.rawValue = this.rawValue;<br /><br />or <br /><fieldname>.rawValue = this.rawValue;<br /> example: TextFieldB.rawValue = this.rawValue;<br /><br />Hope this helps...<br /><br />SekharN

Avatar

Former Community Member
Hi, thank for your reply, I've tried with:



this.parent.ContoCorrente[8].rawValue = this.rawValue;



but I've this error:



TypeError: this.parent.ContoCorrente[8] has no properties

1:XFA:topmostSubform[0]:Page1[0]:ContoCorrente[0]:exit



what does means?

Avatar

Level 5
I have no idea what it exactly translates to. But I am confused with ContoCorrente[8]. This indicates at least 9 instances of the field with same name 'ContoCorrente' and you are trying to match the 9th instance of the field with another. If that is true you should not get that error. If you named each field differently in the subform you just have to use

this.parent.ContoCorrente.rawValue = this.rawValue;

and do not forget to set the Script mode to JavaScript.



And if you still have trouble getting it working just email me a copy at 'meetsekharv AT yahoo.com' with brief description about the two fields that you want to mach the value.



Good luck,

SekharN