cancel
Showing results for 
Search instead for 
Did you mean: 

Change data binding through scripting

Former Member
0 Kudos

Hello,

is somebody able to tell me, how to change the data-binding through scripting.

Background information:

I have different text-elements, based on specific flag the data-binding of one text-field should change. (Another text-element should be then populated)

Best

Carsten

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Please find the script below :

you can refer the text field here as well and accordingly depending on the value of the text field, you can replace the binding of the field2.

if (this.bind.ref != "") {

var DataBinding = this.bind.ref;

// the data binding may contain "$data.<root data name>" instead of $record

DataBinding = DataBinding.replace("$data."+xfa.record.name,"$record");

DataBinding = DataBinding.replace("$record.", "");

try this and let me know..this should work.

Hope this helps.

Best Regards,

Saujanya

Former Member
0 Kudos

Hi Saujanya,

thanks for you reply, but I couldn't get it up and running. Do I have to do a remerge of the form?

I tried to implement your script into a Textfield (e.g. exit event), by executing this, the textfield should change the content, according to its new databinding. Is it allowed to use

this.bind.ref ="$record.entry[*].city.population";

for changing the data binding?

Best

Carsten

Former Member
0 Kudos

hi,

i dont think this will work.You cannot ref the field name.

you have to take the data binding ref of the record, and then mention the field name which needs to be changed.

Coz ur question was to dynamically change the binding? isnt it? its not wrt to field value.. am i correct?

If not , please update the question with more details.

Best Regards,

Saujanya