Skip to content

Normalize masked phone and tax-ID values

This operation post-processes the raw text of a SAIFWebMaskEdit control so consuming code-behind receives an empty string for unfilled fields and a phone value with no dangling extension marker, instead of the mask's literal formatting characters.

Field Value
Operation ID OP-05
Trigger Consuming code-behind reads PhoneValue or TaxIdValue
Inputs Inherited RawText and Text from WebMaskEdit
Outputs Normalized String
Primary components SAIFWebMaskEdit.PhoneValue, SAIFWebMaskEdit.TaxIdValue
Entry point SAIF.Presentation.Web.Controls.Infragistics111/SAIFWebMaskEdit.vb

Steps

PhoneValue:

  1. Initialize the result to String.Empty and enter a Try block.
  2. If RawText.Trim.Length = 0, return the empty string — the mask literals are never returned as data (BR-CTL-014).
  3. Otherwise assign Text.Trim to the result.
  4. If the extension marker x is present and is the final segment (nothing follows it), truncate the value at the marker so a phone entered without an extension carries no trailing x (BR-CTL-015).
  5. Catch System.Data.StrongTypingException and return an empty string (BR-CTL-014).
  6. On failure: any other exception type is not caught and propagates to the caller.

TaxIdValue:

  1. If RawText.Trim.Length = 0, return String.Empty (BR-CTL-014).
  2. Otherwise return Text unchanged (not trimmed).

Process flow

The following diagram visualizes the PhoneValue control flow (the primary branch-bearing path in this operation).

flowchart TD
    Start([PhoneValue read]) --> D1{"RawText.Trim.Length == 0?"}
    D1 -->|Yes| EndEmpty(["Return empty string"])
    D1 -->|No| S1["result = Text.Trim"]
    S1 --> D2{"Trailing 'x' with<br>nothing after it?"}
    D2 -->|Yes| S2["Truncate at marker"]
    D2 -->|No| EndVal(["Return result"])
    S2 --> EndVal
    S1 -.->|StrongTypingException| EndCaught(["Return empty string"])

Failure and edge-case behavior

  • PhoneValue catches only System.Data.StrongTypingException; any other exception raised while reading Text/RawText propagates to the caller uncaught.
  • TaxIdValue does not trim the returned value when non-empty, unlike PhoneValue, which trims before further processing.

Sources

  • SAIF.Presentation.Web.Controls.Infragistics111/SAIFWebMaskEdit.vb