A mapp View screen binds one TextInput to a string variable whose target changes with the selected field. Some targets contain text; others contain numeric text. The engineering requirement is to present an alphanumeric keyboard for the former and a numeric keyboard for the latter without changing the stored data type.
Define the Constraint
The available evidence does not establish a native method for dynamically changing the keyboard associated with one TextInput. Keeping the full keyboard is functional because operators can use its number keys, but it does not prevent letters or symbols from being entered into numeric-only fields.
Do not infer validity from the string data type. When a selected field represents a number, validate its characters or conversion result separately before accepting the edit.
Select an Input Strategy
| Strategy | Data handling | Evidence-based limitation |
|---|---|---|
Keep one TextInput
|
Retains the string binding | Uses the full keyboard; the operator must select number keys for numeric values. |
| Restrict characters | Retains the string binding | Restricting letters and symbols on the alphanumeric keyboard was proposed but not verified. |
Alternate TextInput and NumericInput
|
Use the control matching the selected field | Numeric values stored as strings require an explicit conversion boundary. |
| Build a custom widget with WDTC | Implement application-specific input behavior | Requires custom development and verification. |
Implement the Dual-Widget Workaround
The most direct supported design path is to place a TextInput and a NumericInput in the same screen location, then show only the control appropriate for the selected field. The same behavior can be encapsulated in a custom widget if it will be reused.
- Classify each selectable field as text or numeric text.
- When the selection changes, expose the
TextInputfor text fields or theNumericInputfor numeric fields, and hide the other control. - For numeric fields, convert the stored string into the numeric type required by the input control. If conversion fails, reject the edit instead of silently substituting a value.
- After a valid numeric edit, convert the result back to the string representation expected by the mapped variable.
Verify Selection, Editing, and Conversion
Test every field classification. Confirm that text selections display the alphanumeric input path and numeric selections display the numeric path. For numeric fields, verify both conversion directions, invalid-string rejection, and preservation of the intended string representation. If character restriction is used instead, verify that every unwanted letter and symbol is blocked before relying on it.
FAQ
Can one mapp View TextInput dynamically switch keyboards?
The supplied evidence does not identify a native dynamic-switching method. Use the full keyboard or alternate between TextInput and NumericInput.
How can I show a numeric keyboard for a number stored as a string?
Show a NumericInput for numeric fields, convert the string before editing, and convert the accepted numeric result back to a string.
Can I block letters on the mapp View alphanumeric keyboard?
Character restriction was proposed as a possible workaround, but the evidence does not confirm it. Test all letters and symbols in the target application before adopting that approach.