---
title: Normalize masked phone and tax-ID values
summary: Returns a masked phone number or tax ID as a clean data value instead of the mask's literal formatting characters.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.Infragistics111
reference_type: package
operation_id: OP-05
trigger: Consuming code-behind reads PhoneValue or TaxIdValue
---

# 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](../business-rules.md#br-ctl-014-empty-masked-field-returns-an-empty-string)).
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](../business-rules.md#br-ctl-015-phone-value-omits-trailing-extension-marker-when-absent)).
5. Catch `System.Data.StrongTypingException` and return an empty string ([BR-CTL-014](../business-rules.md#br-ctl-014-empty-masked-field-returns-an-empty-string)).
   - 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](../business-rules.md#br-ctl-014-empty-masked-field-returns-an-empty-string)).
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).

```mermaid
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.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `SAIF.Presentation.Web.Controls.Infragistics111/SAIFWebMaskEdit.vb`
