How can I delete the contents of multiple text fields with one clear all button?
Hey @paul84 and welcome to the community! There are a few of ways you can do this: the easiest would be using event handlers. If you have two text inputs, you could clear both of them at the click of a button by adding two event handlers to the button:
If you want to only deal with one event handler, you can create a JS query that clears the value of both text inputs, and then trigger that query via a click event handler on the button:
Finally, you could also move the contents of that JS query to an event handler script instead:
Let me know if this helps!
@justin Thanks a lot, but unfortunately none of the solutions work for me.
- For Version 1 I don't see the option "Clear Value"
- For Version with query I get the error message "clear_all: input_textfield.clearValue is not a function"
- the other variants do not give an error message, but also do not remove any text
@justin It seems that with rich text editor this is not working
Hey @paul84, Would it work for your use case to use
richTextEditor1.setValue('') to set the value as an empty string?
This effectively clears the value of the component.
@everett_smith Great, thanks!