mikhael,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<form class="webform4" id="webform-4">
<input required="required" type="radio" id="edit-submitted-2-1" name="submitted[2]" value="a" class="form-radio">
<input required="required" type="radio" id="edit-submitted-2-2" name="submitted[2]" value="ab" class="form-radio">
<input required="required" type="radio" id="edit-submitted-2-3" name="submitted[2]" value="ba" class="form-radio">
<input required="required" type="radio" id="edit-submitted-2-4" name="submitted[2]" value="b" class="form-radio">
<input class="form-control form-text" type="text" id="edit-submitted-2a" name="submitted[2a]" value="" size="60" maxlength="128">
<input class="form-control form-text" type="text" id="edit-submitted-2b" name="submitted[2b]" value="" size="60" maxlength="128">
<input required="required" type="radio" id="edit-submitted-3-1" name="submitted[3]" value="a" class="form-radio">
<input required="required" type="radio" id="edit-submitted-3-2" name="submitted[3]" value="ab" class="form-radio">
<input required="required" type="radio" id="edit-submitted-3-3" name="submitted[3]" value="ba" class="form-radio">
<input required="required" type="radio" id="edit-submitted-3-4" name="submitted[3]" value="b" class="form-radio">
<input class="form-control form-text" type="text" id="edit-submitted-3a" name="submitted[3a]" value="" size="60" maxlength="128">
<input class="form-control form-text" type="text" id="edit-submitted-3b" name="submitted[3b]" value="" size="60" maxlength="128">
.....
<input required="required" type="radio" id="edit-submitted-n-1" name="submitted[n]" value="a" class="form-radio">
<input required="required" type="radio" id="edit-submitted-n-2" name="submitted[n]" value="ab" class="form-radio">
<input required="required" type="radio" id="edit-submitted-n-3" name="submitted[n]" value="ba" class="form-radio">
<input required="required" type="radio" id="edit-submitted-n-4" name="submitted[n]" value="b" class="form-radio">
<input class="form-control form-text" type="text" id="edit-submitted-na" name="submitted[na]" value="" size="60" maxlength="128">
<input class="form-control form-text" type="text" id="edit-submitted-nb" name="submitted[nb]" value="" size="60" maxlength="128">
</form>
<script>
window.addEventListener('DOMContentLoaded', function() {
var form = document.querySelector('#webform-4'),
obj = {a : [10,40], ab : [20,30], ba : [50,80], b :[70,60]};
form.addEventListener('change', function(event) {
var el = event.target, val = el.value;
if(val = obj[val]) {
while (el) {
el = el.nextElementSibling;
if(el && el.classList.contains("form-control")) break
}
el.value = val[0];
el.nextElementSibling.value = val[1]
}
});
});
</script>
</body>
</html>