Skip to content

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).
  2. Register the script under key SDTE_Focus if not already registered.
  3. 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.*
  4. Add an onfocus attribute to the control that invokes SAIFWebDateTimeEdit_Focus('<ClientID>') (BR-CTL-012).
  5. 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, BR-CTL-013).
  6. 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.

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.*

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