Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to dynamically do the data binding (two-way binding as it happens when we do data binding through binding tab) through javascript?

Avatar

Avatar
Level 1
nehadushyani
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
nehadushyani
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile
nehadushyani
Level 1

04-12-2019

Is there any other method rather than using the following code, for populating and binding the data at the same time:-

this.rawValue=xfa.resolveNode("$record.aaa.bbb").value;

The other way to bind data to the fields could be:-

Form.MyForm.bind.match="dataRef";

Form.MyForm.bind.ref="$record.aaa.bbb";

But, this code is not working. It's written at initialize event.

Even if have written the following at form:ready event, with this:-

$form.remerge();

What is the significance of this code? If this is not the right code, please describe any other javascript code/method.

In anyway, I want to bind the data with field as we do in binding tab in AEM Designer. By two way binding I mean that on changing the record the value for field gets updated and also the vice-versa should happen, as it happens when binding is done through binding tab.

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

08-12-2019

You can use the setProperty property to bind various properties of a field or subform to a dataset which can be manipulated or replaced by scripting.

<!-- Set the fields font size to a value stored in the node Form.Style.FontSize under the default dataset "data". -->

<setProperty ref="$data.Form.Style.FontSize" target="font.size"/>

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

270 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

05-12-2019

I don't think you can script against the binding properties.  If you can explain what you are trying to achieve, at a higher level, then we might be able to offer some alternatives.  If you are wanting to change the binding from one element in your xml to another you might be able to use predicts.

The remerge method takes the template DOM and data DOM and rebuilds the form DOM, so even if your scripting worked it would be reset by the remerge.

Regards

Bruce