Nov 24, 2013, 6:21 AM
[CLOSED] Validation status after saving and clearing the form fields
Hi all,
In a form we have many fields which are mandatory(by using allowBlank=false).
After saving those details we are clearing all the data from the fields.
At this time the validation message is showing and also allowblank is also firing.
See the below link for validationstatus
https://examples2.ext.net/#/Toolbar/StatusBar/Advanced/
See the following code to reproduce the issue.
Please contact if you need more explanation
In a form we have many fields which are mandatory(by using allowBlank=false).
After saving those details we are clearing all the data from the fields.
At this time the validation message is showing and also allowblank is also firing.
See the below link for validationstatus
https://examples2.ext.net/#/Toolbar/StatusBar/Advanced/
See the following code to reproduce the issue.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm18.aspx.cs" Inherits="Ext2._2Practice.WebForm18" %>
<%@ Register Namespace="Ext.Net" Assembly="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script runat="server">
protected void FormSave(object sender, DirectEventArgs e)
{
FormStatusBar.SetStatus(new StatusBarStatusConfig { Text = "Form saved!", IconCls = " ", Clear2 = true });
TextField1.Text = string.Empty;
DateField1.SetValue(null);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1"
runat="server"
Title="StatusBar with Integrated Form Validation"
Width="350"
Height="160"
Layout="Fit">
<Items>
<ext:FormPanel
ID="StatusForm"
runat="server"
LabelWidth="75"
ButtonAlign="Right"
Border="false"
Padding="10">
<Defaults>
<ext:Parameter Name="Anchor" Value="95%" />
<ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
<ext:Parameter Name="SelectOnFocus" Value="true" Mode="Raw" />
<ext:Parameter Name="MsgTarget" Value="side" />
</Defaults>
<Items>
<ext:TextField ID="TextField1" runat="server" FieldLabel="Name" BlankText="Name is required" />
<ext:DateField ID="DateField1" runat="server" FieldLabel="Birthdate" BlankText="Birthdate is required" />
</Items>
<Buttons>
<ext:Button ID="Button1" runat="server" Text="Save" Icon="Disk">
<DirectEvents>
<Click
OnEvent="FormSave"
Before="var valid= #{StatusForm}.getForm().isValid(); if (valid) {#{FormStatusBar}.showBusy('Saving form...');} return valid;">
<EventMask
ShowMask="true"
MinDelay="1000"
Target="CustomTarget"
CustomTarget="={#{StatusForm}.getEl()}" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
<BottomBar>
<ext:StatusBar ID="FormStatusBar" runat="server" DefaultText="Ready">
<Plugins>
<ext:ValidationStatus ID="ValidationStatus1"
runat="server"
FormPanelID="StatusForm"
ValidIcon="Accept"
ErrorIcon="Exclamation" />
</Plugins>
</ext:StatusBar>
</BottomBar>
</ext:Panel>
</form>
</body>
</html>
Please look at the attached imagePlease contact if you need more explanation
Last edited by Daniil; Dec 03, 2013 at 12:47 PM.
Reason: [CLOSED]