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:
- Initialize the result to
String.Emptyand enter aTryblock. - If
RawText.Trim.Length = 0, return the empty string — the mask literals are never returned as data (BR-CTL-014). - Otherwise assign
Text.Trimto the result. - If the extension marker
xis present and is the final segment (nothing follows it), truncate the value at the marker so a phone entered without an extension carries no trailingx(BR-CTL-015). - Catch
System.Data.StrongTypingExceptionand return an empty string (BR-CTL-014). - On failure: any other exception type is not caught and propagates to the caller.
TaxIdValue:
- If
RawText.Trim.Length = 0, returnString.Empty(BR-CTL-014). - Otherwise return
Textunchanged (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¶
PhoneValuecatches onlySystem.Data.StrongTypingException; any other exception raised while readingText/RawTextpropagates to the caller uncaught.TaxIdValuedoes not trim the returned value when non-empty, unlikePhoneValue, which trims before further processing.
Related documentation¶
Sources¶
SAIF.Presentation.Web.Controls.Infragistics111/SAIFWebMaskEdit.vb