The other way to bind data to the fields could be:-
But, this code is not working. It's written at initialize event.
Even if have written the following at form:ready event, with this:-
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.
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.