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¶
- On
Init, build theSAIFWebDateTimeEdit_Focus(inEditId)client function as a string (BR-CTL-012). - Register the script under key
SDTE_Focusif 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
IsClientScriptBlockRegisteredguard.* - Add an
onfocusattribute to the control that invokesSAIFWebDateTimeEdit_Focus('<ClientID>')(BR-CTL-012). - In the browser, on focus the function resolves the editor via
igedit_getById, and if the displayed text equals01/01/1901or12/31/9999it callssetValue(null), clearing the sentinel (BR-CTL-012, BR-CTL-013). - If the displayed text is neither sentinel value: the function returns
truewithout 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.*
Related documentation¶
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