Hey Sara! I had a similar issue before, and I got it working. Here’s what I did using toolbox plugin. Make sure your JavaScript to Bubble event triggers properly and updates your workflow:
1. Add the “JavaScript to Bubble” element
- Drag the “JavaScript to Bubble” element onto your page.
- In the element settings:
- Set a Function Name (e.g.,
removedText).
- Remeber to check the “Trigger event” box and Plublish value
- Set the type to Text.
2. Modify your JavaScript in the “Run JavaScript” action
Use this script in your “Run JavaScript” action:
function removeEmojis(text) {
return text.replace(/[\p{Emoji}\u200d]+/gu, '');
}
// Make sure the function exists before calling it
if (typeof bubble_fn_removedText === "function") {
bubble_fn_removedText(removeEmojis(properties.param1));
} else {
console.error("Bubble function not found.");
}
param1 should be the input value you’re checking for emojis.
3. Create a workflow after the submit button
4. Use the JavaScript to Bubble Result
There are two ways to use the cleaned text:
- Trigger a workflow:
- Create a “When JavaScript to Bubble - removedText’s value is changed” event.
- Make sure no unnecessary conditions are blocking it.
1 Like