Showing next widget on key press


#1

Hi everyone, I’m working on a project and need to simulate a conversation with a chatbot. I’m taking a shortcut with faking a conversation, and wanted to know how I could have the next part of the conversation shown by continuing to press the enter key in the text field.


#2

Here’s one way to do it:

Put an onKeyUp event on the text field that checks if the key pressed was “Return”, and then add logic to see which mesages are shown. I used else if’s so that it goes down the tree. You could probably do this with a repeater, or try to centralize the logic if you wanted to. Kind of depends on how many messages you need to show and how complex the interactions are. You’ll find an example attached below:

Enter to Show Message.rp (47.4 KB)


#3

Thank you so much, that’s exactly what I needed!


closed #4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.