How to remove characters from input field after tapping on icon?

Hi,

I have an input field which is bound to page variable. And now I want to remove written characters from this input field after tapping on icon. How can I achieve it?

Thank you.

Hey, go into the logic flow of your icon/button and, at the very end, after whatever logic stores the data from your input to your backend or whatever have you, place a “Set page variable” with the appropriate variable name and with an assigned value of nil/nothing. In other words, leave the Assigned Value field blank. Now, if your data is successfully processed, it will reset the input field to blank when the icon/button is tapped. :slight_smile:

Hi, Dominik.

thanks for your quick response.
I’ve also tried to do It this way, but it just doesn’t work for some reason. Page variable is of the text type, and my empty assigned value is also of text type.
Or am I missing something?

Hm, there’s nothing wrong that I can see with your logic.

Two things you might try:

  1. Temporarily disconnect the UnfocusInput and SetPV-CancelButton and test again with just the variable to clear the field. I just tested this with a fresh input/variable and it does work for me.

and/or

  1. Try connecting your logic in a linear fashion, i.e. in this order: “SetPV-Search to” → “SetPV-CancelButton” → “Unfocus Input”.

Also, is it possible that, in your preview, the button is actually being pushed out of the visual interface? It is a glitch I’ve encountered when nesting an input and text/buttons side-by-side in a container. The input will push the text/button visually outside of the container. While this wouldn’t break your logic, I’m having a gut feeling that, since this appears to be a mobile app, it might be misplacing the functional “tap/click” area of the button in your preview.

Does it still unfocus the input and whatnot (or anything at all) when you tap it in preview? If nothing at all is firing, you might try setting the button temporarily outside of the container with the input and trying again.

In fact, the above post might be the problem! By the looks of it, your input selection guide is floating somewhat awkwardly above the Cancel button. It may very well be blocking tapping/clicking the button. (I’m assuming you’re using the “Search Bar” composite from the Lists components.)

Thank you once again :slight_smile:

I was able to figure it out, there was a problem with my page variable. Instead of page variable “Search” I wrote “search”, which was causing the issue.