Skip to content

Present the context search box

Render and manage the context search textbox, including its watermark/placeholder behaviour and change notification. This operation is implemented by SAIFMenu.InitializeControls, SAIFMenu.ContextValue.

Field Value
Operation ID OP-MENU-003
Trigger SAIFMenu.InitializeControls, invoked from CreateControls during OnLoad; property access on ContextValue.
Inputs ContextViewStyle, ContextLabel, UpperCaseContextValue, posted textbox value.
Outputs Rendered context textbox; ContextValue property; OnContextChanged event.
Primary components SAIFMenu.InitializeControls, SAIFMenu.ContextValue
Entry point SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb

Steps

  1. Apply the ContextViewStyle: Normal shows an editable box, Read_Only shows a read-only box, Hidden hides it. Enforces BR-MENU-011.
  2. In Normal mode with an empty value and a non-empty ContextLabel, display the label as watermark text styled watermark. Enforces BR-MENU-012.
  3. Attach OnFocus / OnBlur handlers passing the label (with single quotes escaped) to the watermark scripts. Enforces BR-MENU-013, BR-MENU-014.
  4. Reading ContextValue returns String.Empty when the box still contains the watermark label, and upper-cases the value when UpperCaseContextValue is set. Enforces BR-MENU-015, BR-MENU-016.
  5. Setting ContextValue trims (and optionally upper-cases) the value and raises OnContextChanged with the old and new values. Enforces BR-MENU-017.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start(["SAIFMenu.InitializeControls"]) --> Style{ContextViewStyle?}
    Style -->|Normal| Editable["Show editable box"]
    Style -->|Read_Only| ReadOnly["Show read-only box"]
    Style -->|Hidden| Hide["Hide the box"]
    Editable --> Empty{Value empty and ContextLabel set?}
    Empty -->|Yes| Watermark["Display label as watermark text"]
    Watermark --> Handlers["Attach OnFocus/OnBlur watermark handlers, escaping quotes"]
    Handlers --> Read["ContextValue read: empty when showing watermark, upper-cased if configured"]
    Read --> SetValue["ContextValue set: trim/upper-case, raise OnContextChanged"]
    SetValue --> End(["Rendered context textbox with ContextValue property"])
    Empty -->|No| Read

Failure and edge-case behavior

  • A ContextLabel containing characters other than a single quote is emitted into the inline script unescaped (BR-MENU-014).

Sources

  • SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb