Skip to main content

addObjectInput

Provides an input mechanism for PIN code entry. The input object collects characters from buttons whose id is a single character, such as "1" or "2".

wizCtl.addObjectInput(id, data)
ParameterDescription
id

String that identifies the object. Can be null or an empty string.
Cannot be any of the values reserved for text or button objects: who, why, ok, clear, cancel, delete.

data

Object with the following fields:

  • minLength - Minimum accepted length.
  • maxLength - Maximum accepted length.
Return values
The added input object. Throws an exception if an error occurs.

The returned object has the following property:

PropertyDescription
onInputFunction called each time an input button is tapped. It receives the following parameters: text (the whole input), inputId (the id of the button tapped), minLength and maxLength.

Use addObjectInputEcho to show the entered characters on the pad.

The following example adds an input that accepts up to four characters:

const inputObject = wizCtl.addObjectInput("Input", {minLength: 1, maxLength: 4});
inputObject.onInput = function(text, inputId, minLength, maxLength) {
console.log("Pressed " + inputId + ", the text is " + text);
}

wizCtl.addObjectButton("1", 100, 80, "1", 40);
wizCtl.addObjectButton("2", 150, 80, "2", 40);
wizCtl.addObjectButton("delete", 100, 130, "<< Delete", 90);