ui.Textbox.onChange
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Enregistre un rappel qui est appelé lorsque le texte de la zone de texte change.
Plus précisément, le rappel est appelé dans les cas suivants :
- L'utilisateur saisit une nouvelle valeur, puis le focus est perdu ou l'utilisateur appuie sur Entrée.
- Une nouvelle valeur est définie de manière programmatique avec set('value', newValue).
Renvoie un ID qui peut être transmis à unlisten() pour annuler l'enregistrement du rappel.
Utilisation | Renvoie |
---|
Textbox.onChange(callback) | Chaîne |
Argument | Type | Détails |
---|
ceci : ui.textbox | ui.Textbox | Instance ui.Textbox. |
callback | Fonction | Rappel à déclencher lorsque le texte change. Le rappel reçoit le texte actuellement dans la zone de texte et le widget de la zone de texte. |
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eTriggers a function when the textbox content is modified, either by user input or programmatically.\u003c/p\u003e\n"],["\u003cp\u003eThe registered function receives the current text and the textbox widget as arguments.\u003c/p\u003e\n"],["\u003cp\u003eProvides a method to unregister the function using a unique ID returned during registration.\u003c/p\u003e\n"],["\u003cp\u003eText change is triggered by user input (typing followed by focus loss or pressing Enter), or by programmatically setting a new value.\u003c/p\u003e\n"]]],[],null,["# ui.Textbox.onChange\n\n\u003cbr /\u003e\n\nRegisters a callback that's called when text in the textbox changes.\n\n\u003cbr /\u003e\n\nIn particular, the callback is called when:\n\n- The user types a new value and then either the textbox loses focus or the user presses enter.\n\n- A new value is set programmatically with set('value', newValue).\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|------------------------------|---------|\n| Textbox.onChange`(callback)` | String |\n\n| Argument | Type | Details |\n|--------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.textbox` | ui.Textbox | The ui.Textbox instance. |\n| `callback` | Function | The callback to fire when the text changes. The callback is passed the text currently in the textbox and the textbox widget. |"]]