Intendi qualcosa del genere ?
codice:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input name="button_sample" id="button_sample" type="checkbox" value="1">
<div class="formgroup">
<input name="sample_fr" type="text" value="">
<input name="sample_de" type="text" value="">
<input name="sample_fr" type="text" value="">
<input name="descrizione_fr" type="text" value="">
<input name="descrizione_fr" type="text" value="">
<input name="descrizione_fr" type="text" value="">
</div>
<script>
const check = document.getElementById('button_sample')
const allInput = document.querySelectorAll('.formgroup > input')
const newValue = [1, 2, 3, 4, 5, 6]
const checkAction = () => {
allInput.forEach((input, idx) => {
input.value = newValue[idx]
});
}
const checkReset = () => {
allInput.forEach(input => {
input.value = ''
});
}
check.addEventListener('click', (e) => {
e.target.checked
? checkAction()
: checkReset()
})
</script>
</body>
</html>