Multi-line character counter¶
Add an optional live character counter to multi-line, length-limited textboxes. Init, CreateChildControls, and RenderControl for a SAIFTextBox instance.
| Field | Value |
|---|---|
| Operation ID | OP-V2-017 |
| Trigger | Init, CreateChildControls, and RenderControl for a SAIFTextBox instance. |
| Inputs | TextMode, MaxLength, ShowCharacterCounter, Visible. |
| Outputs | The base textbox, optionally followed by a character-counter panel and a SaifMaxLength attribute. |
| Primary components | SAIFTextBox |
| Entry point | SAIF.Presentation.Web.Controls.V2/SAIFTextBox.vb |
Steps¶
- On
Init, register/Resources/Scripts/Controls/TextBox.jsunless already registered. (BR-V2-095) - On
CreateChildControls, whenTextModeisMultiLine,MaxLengthis greater than zero andShowCharacterCounteris true, add aPanelwith IDmsgand CSS classsaiftextlimitmsgsized to the textbox width. (BR-V2-096) - On
RenderControl, when invisible render nothing; when multi-line with a maximum length, emit theSaifMaxLengthattribute, render the base textbox, then render the counter panel if the counter is enabled; otherwise render the base textbox only. (BR-V2-097, BR-V2-098, BR-V2-099)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Init]) --> Script[Register TextBox.js]
Script --> CCC[CreateChildControls]
CCC --> Cond{MultiLine, MaxLength>0, ShowCharacterCounter?}
Cond -->|Yes| Counter[Add msg counter panel]
Cond -->|No| Skip[No counter panel]
Counter --> Render([RenderControl])
Skip --> Render
Render --> Vis{Visible?}
Vis -->|No| NoOut([No output])
Vis -->|Yes| Emit[Emit SaifMaxLength, render base textbox + counter]
Failure and edge-case behavior¶
- No exceptional failure handling beyond the branches described in Steps was found in the analysis findings.*
Related documentation¶
Sources¶
SAIF.Presentation.Web.Controls.V2/SAIFTextBox.vb