i am trying to get the updated text from a text field when a user changes the text so that I can update that data in the database.
I cannot seem to find an event that works for this.
If I use a change script on props.text. That event fires whenever i load new records or change records.
If I use the onCompsitionEnd or onCompositionUpdate, these events don’t seem to be firing.
I’d really prefer not to have some pesky save button that users forget to push.
Did you ever get this working? I would like to do something similar.
Bumping this thread because I’m having the same issue in 8.1. I can’t get any onComposition events to fire. Are these events intended to fire when the user changes the value of a text field?
Using a change script is not ideal in my situation because I only want the script to execute when the value is changed from the text field (not other sources).
First things first:
onCompositionXXX Events are used to accommodate languages which do not use “latin” characters, so don’t expect these events to help you in this situation.
After wracking my brain trying to find a way to manage this and thinking there must be an easy way, I reached out to Dev and was reminded that there IS INDEED AN EASY WAY.
In the onChange script, specify that you only take an action if the origin is the browser:
if origin == 'Browser':
# update database
This will result in the update only taking place if the “user” has changed the value, as opposed to a “Binding” or “Script”.
Thanks! That works perfectly.
I would recommend updating the documentation for the
onCompositionXXX events. This page says:
onCompostionUpdate: Triggers when a new character is received while composing text on an input component
This really sounds like it is meant to update while the user is typing.
Wanted to bump this, since I’m running into the same frustrations with a Dropdown component. Since the Dropdown also has the ability to enter custom text (if allowCustomOptions is enabled), I thought I’d be able to use the onCompositionEnd event if the user manually enters text to open a popup for her/him to confirm whether to add the new value to the database.
The proposed solution to filter on:
isn’t as straightforward for the Dropdown, since the props.value field would also be changed by the browser when a user selects an existing option. In this case, I also need to filter out numeric values and ‘null’, which is what is set after clearing. I’m sure this solution will work, but just seems like kind of a kludgy workaround.
Like @rberghammer, I’d recommend either clarifying this in the documentation or fixing it so the events fire as expected.
I’ll reach out to the documentation team, but to be clear: the Events do fire as expected - they’re just not being used as they are intended to be used.
I’ve been using the Focus Events / onBlur event to trigger scripts. When the field loses focus ( tab or click off of it) the script runs.
I’ll weigh in on this too. I’m not finding anything called an ‘onChange’ script for the text field component.
I guess I will just have to do some scripting for the onKeyPress that registers if they hit enter, then take the text and do my intended action.
It would be nice if these text components had a selected property too.
The “change script” is accessed by right-clicking the property which might change and selecting “Add Change Script” from the context menu. “Change” scripts are not a component-interaction event, so they’re in a different location.
You’re looking for