Return to the menu   Select another DES Module

Demonstrates showing text or an image on a validator when there is no error, such as after the error was fixed

Validators provide the NoErrorFormatter property to shows text and/or an image when there is no error to display. It is commonly used to clearly state that the error has been fixed or there is no error. For example, when the user corrects the error, an image. It can also show an indicator that a field has yet to be edited.

When setup, it appears in the location of the Validator. It can show an image and text.

The Validator.NoErrorFormatter property offers these properties to customize it:

  • Mode – Determines when to show the text and image. It has these values:
    • Off – Do not use the NoErrorFormatter.
    • Default – Use the value assigned to the DefaultNoErrorFormatterMode property in the Global Settings Editor.
    • Always – Always show when there is no error. It will appear as the page is first displayed. It will be removed as an error is revealed. It will return after the error is fixed.
    • Corrected – Show after the user fixes the error. It appears after the Validator displays the error and the user corrects it.
    • Validated – Show after the field has been validated and has no errors. The user does not have to edit to cause this. For example, if a field requires text and opens with text in the textbox, when the user clicks Submit, the RequiredTextValidator will validate and the NoErrorFormatter appears.
    • FirstTime - Show only on a new page, prior to any edits. It is hidden after validation occurs. Never show on a post back page because validation has already occurred. It lets you attract users to fields that have not been edited yet.
  • ImageURL - The URL to an image file. If assigned, an image will appear before the Text or at the location of the "{IMAGE}" token within the Text property.
  • Text – Assign when you want to display text or HTML.
  • CssClass – The style sheet class name applied to the text and image.

Controls

Mode=Always


Mode=Corrected


Mode=FirstTime

Pending an entry

Mode=Validated



Source Code (C#)

<script runat="server">
protected void Button1_Click(object sender, EventArgs e) { if (PeterBlum.DES.Globals.WebFormDirector.IsValid) { // save your data here } }
</script> <h3>Mode=Always</h3> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <des:RequiredTextValidator ID="RequiredTextValidator1" runat="server" ControlIDToEvaluate="TextBox1" ErrorMessage="Required" NoErrorFormatter-Mode="Always" NoErrorFormatter-ImageURL="{APPEARANCE}/Validation/validicon.GIF"> </des:RequiredTextValidator> <br/> <h3>Mode=Corrected</h3> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <des:RequiredTextValidator ID="RequiredTextValidator2" runat="server" ControlIDToEvaluate="TextBox2" ErrorMessage="Required" NoErrorFormatter-Mode="Corrected" NoErrorFormatter-Text="Fixed. Thanks!"> </des:RequiredTextValidator> <br/> <h3>Mode=FirstTime</h3> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <des:RequiredTextValidator ID="RequiredTextValidator3" runat="server" ControlIDToEvaluate="TextBox3" ErrorMessage="Required" NoErrorFormatter-Mode="FirstTime" NoErrorFormatter-Text="Pending an entry" NoErrorFormatter-CssClass="DESVALErrorText"> </des:RequiredTextValidator> <br/> <h3>Mode=Validated</h3> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> <des:RequiredTextValidator ID="RequiredTextValidator4" runat="server" ControlIDToEvaluate="TextBox4" ErrorMessage="Required" NoErrorFormatter-Mode="Validated" NoErrorFormatter-Text="Good data" NoErrorFormatter-ImageURL="{APPEARANCE}/Validation/validicon.GIF" > </des:RequiredTextValidator> <br/> <des:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click"></des:Button>

Return to the menu   Select another DES Module