Is it possible to clear the Default Text on a TextInput box OnSelect? What I have is an app where data entry happens, but to save space I describe the data to enter in a given field inside the text entry box itself (by using Default). Is there any way to clear the box OnSelect? The Clear Button isn't really what I want, I want it to automatically clear when first selected, like may fields in the web do.
Solved! Go to Solution.
You can do something like this:
- Screen:
- OnVisible: UpdateContext({maintext: "Text You Want To Show"})
- TextInput
- OnSelect: UpdateContext({maintext: ""})
- Default: maintext
You can do something like this:
- Screen:
- OnVisible: UpdateContext({maintext: "Text You Want To Show"})
- TextInput
- OnSelect: UpdateContext({maintext: ""})
- Default: maintext
Ah, that did it! In fact, that also solved my secondary question of how to reset those when submitting. I just redid the UpdateContext for OnSubmit of my button, and as soon as the submission completed, all my fields were back to default! Perfect for a rapid intake form that needs no extra verification.
Hi
Just additional notes.
All TextInput comes with Reset.false/true.
You can set to Reset.true
[UpdateContext({XX: " "}); UpdateContext({XX: ""}) is very flexible to use, too]
Just sharing in case you are using this.
Hope this helps.,
This code also does it:
[UpdateContext({XX: "", XY: "", XZ: ""})]
From what I understand, you want functionality equivalent to the HTML input 'placeholder' attribute. In that case, you'll want to use the TextInput control's HintText attribute, not the Default attribute. The accepted solution works ok, but there are a number of edge cases it does not account for. I'd recommend using the built in attribute for this.
User | Count |
---|---|
261 | |
110 | |
97 | |
53 | |
39 |