---
title: Suppress sentinel dates on focus
summary: Clears a date editor's value when it displays a sentinel min/max date so the user can enter a real date.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.Infragistics111
reference_type: package
operation_id: OP-04
trigger: Control Init event registers the script; the browser onfocus event on the rendered input then runs it
---

# Suppress sentinel dates on focus

This operation registers a client-side function that clears a `SAIFWebDateTimeEdit` field the moment the user focuses it, if the field is currently displaying a sentinel date used to represent "no date".

| Field | Value |
| --- | --- |
| **Operation ID** | OP-04 |
| **Trigger** | Control `Init` event registers the script; the browser `onfocus` event on the rendered input then runs it |
| **Inputs** | The control's current displayed text |
| **Outputs** | Registered script block `SDTE_Focus`; an `onfocus` attribute on the rendered element |
| **Primary components** | `SAIFWebDateTimeEdit` |
| **Entry point** | `SAIF.Presentation.Web.Controls.Infragistics111/SAIFWebDateTimeEdit.vb` |

## Steps

1. On `Init`, build the `SAIFWebDateTimeEdit_Focus(inEditId)` client function as a string ([BR-CTL-012](../business-rules.md#br-ctl-012-focusing-a-sentinel-date-clears-the-field)).
2. Register the script under key `SDTE_Focus` if not already registered.
   - The same guarded registration is coded twice in succession; the second registration attempt is unreachable in effect because the first registration already satisfies the `IsClientScriptBlockRegistered` guard.*
3. Add an `onfocus` attribute to the control that invokes `SAIFWebDateTimeEdit_Focus('<ClientID>')` ([BR-CTL-012](../business-rules.md#br-ctl-012-focusing-a-sentinel-date-clears-the-field)).
4. In the browser, on focus the function resolves the editor via `igedit_getById`, and if the displayed text equals `01/01/1901` or `12/31/9999` it calls `setValue(null)`, clearing the sentinel ([BR-CTL-012](../business-rules.md#br-ctl-012-focusing-a-sentinel-date-clears-the-field), [BR-CTL-013](../business-rules.md#br-ctl-013-mindate-and-maxdate-are-treated-as-null-dates)).
   - If the displayed text is neither sentinel value: the function returns `true` without modifying the field.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Control Init]) --> S1["Build SAIFWebDateTimeEdit_Focus script"]
	S1 --> S2["Register script SDTE_Focus<br>if not already registered"]
	S2 --> S3["Add onfocus attribute<br>to rendered element"]
	S3 --> Client["Browser: user focuses field"]
	Client --> D{"Text == 01/01/1901<br>or 12/31/9999?"}
	D -->|Yes| Clear(["setValue(null)"])
	D -->|No| NoOp(["Return true, no change"])
```

## Failure and edge-case behavior
- The duplicated registration guard has no functional effect beyond the redundant code path; the script is still registered exactly once per page.*

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

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

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