How to copy data frontend from object to object.

1
I have a planning object with an association to seven weekday-objects, having three attributes per day, thus the user can enter 21-attributes. Now I have a requirement to copy values from one weekday to another. The ui looks like this: I want to copy values from one weekday to another weekday, at the frontend. The 7 weekday-objects are already available, you can see them. When changing the value 2329 at Monday, I want the new value to get copied to the 6 other weekday-objects. I expect this to be possible and done in the frontend, either with javascript or nanoflow. But how to do that? Edited: And I want to do that with the data that is already available in the frontend, so without doing a retrieve.   Edited2: before being able to spend enough time on this, the requirements changed.
asked
2 answers
1

Can't you do a on change nanoflow that has the monday object as input parameter, then retrieve the other objects over association and then change them(or loop over and change them) with the monday value with a refresh?

answered
1

What about a Javascript snippet like this. It does require the textfields to have a class.

var textFields = document.getElementsByClassName("yourClass");
var firstfield = textFields[0];

firstfield.onBlur = function() {
    var valueToSet = this.value;

    for(var i=1; i<textFields.length; i++) {
        textFields[i].value = valueToSet;
    }
}

 

answered