Multi-Line Input: Enter to Submit inside a Repeating Group?

I have a multi-line input inside a Repeating Group. It’s auto-binding to that cell’s content. I’d like to use enter to submit the changes, and as a bonus, Esc to cancel changes.

I tried the 1T Input Monitor, but that doesn’t seem to be an option for inputs inside Repeating Groups. It seems to work well as a chat input field, but not if it’s inside a cell of a repeating group.

Has anyone achieved this? Thanks guys!

You try a hack like checking for focusin event in JS when fired , when the multiline element is focused and do whatever operations you want when pressed enter or esc,
Try adding below code in HTML element as below and test it out put it inside script block as i am not able to paste it here.
This is just a hack, there can be better ways to do this.

" var focusedInput = null;

document.addEventListener(‘focusin’, function(event) {
if (event.target.matches(‘textarea’)) {
focusedInput = event.target;
}
});

document.addEventListener(‘focusout’, function(event) {
if (event.target === focusedInput) {
focusedInput = null;
}
});

document.addEventListener(‘keydown’, function(event) {
if (focusedInput && (event.key === ‘Enter’ || event.key === ‘Escape’)) {
event.preventDefault();
if (event.key === ‘Enter’) {
// Logic for Enter key
alert(‘Enter pressed on input’);
} else {
// Logic for Escape key
alert(‘Escape pressed on input’);
}
}
});
"

1 Like

Hey thanks for your help here, any chance you can elaborate as to how this would look inside a workflows?

I’m guessing I place the JS inside an html, but how do I trigger each of the events? Remember that this input is inside each cell of a repeating group. That’s the challenge.

This topic was automatically closed after 70 days. New replies are no longer allowed.