Hi there!
Here is a trick tip about how to display values from multiple text inputs in the text input
Demo:
Okay, we have 4 text inputs fields, results will be displaying in field 4.
Step 1. To each field add class suffixes:
- custom-field-1
- custom-field-2
- custom-field-3
- custom-field-4
Step 2. Add this code to the forms js editor
document.addEventListener('DOMContentLoaded', function(){
let custom = {
text: '{custom-field-1} {custom-field-2} {custom-field-3}',
parts: ['custom-field-1', 'custom-field-2', 'custom-field-3'],
target: 'custom-field-4',
update: () => {
let text = custom.text;
custom.parts.forEach((part) => {
let value = $f('.'+part).find('input, textarea').val();
text = text.replace('{'+part+'}', value);
});
$f('.'+custom.target).find('input, textarea').val(text);
},
}
custom.parts.forEach((part) => {
$f('.'+part).on('input', 'input, textarea', custom.update)
});
});
Step 3. Enjoy!
Regards,
Artem, Balbooa.com