Follow

Masked Text

The Masked Text control allows for text entry within a mask.  This can be useful for entering formatted text like phone numbers, postal codes, etc

Like almost all SPARK controls, you can trigger events that are fired when the user interacts with the control (see the Event and Methods sections below and the Event Handling article for more information). 

The Masked Text control can be bound to a String variable.

This control is most commonly used when specific user input formats are required such as credit card numbers or phone numbers.

Appearance

Monospace This prevents the mask from moving as the text is entered

Width Value in px, %, em For example: 50px, 20%, 0.4em. 

Size Style Default, Large, Small

Label Placement Top, Left

Behavior

Tab Index Form control tabbing sequence index. Tab indices start at 1, and may be set sparsely.

Placeholder Text "Ghost" text displayed when no input. Most commonly the same as text as the mask

Mask Use # to indicate where numbers may be entered, and 'a' for alpha characters.

Auto Clear Invalid Text  Automatically clears invalid text

Example

These are the configuration option settings for numeric Masked Text...

These are the results when you ...

Load the Page Click the Field Input Data

These are the configuration options for alpha Masked Text...

These are the results when you ...

Load the Page Click the Field Input Data

 

Events

With the Masked Text control, there are 5 types of event handlers:

  • On Load When the page loads
  • On Change When there is a change to the data in the control
  • On Focus When the control gets focus
  • On Blur When clicked or tabbed away from the control
  • On Input When the user inputs data

You can use JavaScript logic to affect the effects of the control, depending on the event. More information on using these controls can be found in the Event Handling article.

 Methods

For detailed information on the available methods for this control, access the JS Doc file.

 

  • Author: Matthew Oatts
  • Date Created: June 5, 2015
  • Date Modified: August 31, 2015
Was this article helpful?
0 out of 0 found this helpful

Comments