PDA

View Full Version : [CLOSED] AllowBlank="false" problem when reopen the window



hdsoso
May 08, 2013, 11:03 AM
there is a window which contains textfield with AllowBlank="false" and a close button in the page.

first I open the window ,then click "save" button to close the window , then click "click me" to open the window, the textfield is show a red border. AllowBlank="false" works.

how to avoid it validate the textfield's text when reopen the window.

how to open the window every time as the window is open at the first time?



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TobrosCWT.BasicInfoSetup.WebForm2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script runat="server">
protected void Unnamed_Event(object sender, DirectEventArgs e)
{
tfSupplierCode.Text = "";
tfAreaCode.Text = "";
tfSupplierCode.Text = "";
tfSupplierForshort.Text = "";
contomSetupWindow.Show();
}

protected void btnSave_Event(object sender, DirectEventArgs e)
{
contomSetupWindow.Close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server"></ext:ResourceManager>
<div>
<ext:Button runat="server" Text="click me!">
<DirectEvents>
<Click OnEvent="Unnamed_Event"></Click>
</DirectEvents>
</ext:Button>
<ext:Window ID="contomSetupWindow" runat="server" Width="538" Height="200" BodyPadding="6" Modal="true" Resizable="false">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch"></ext:VBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:FormPanel ID="formSupplier" runat="server" BaseCls="x-plain">
<LayoutConfig>
<ext:HBoxLayoutConfig Align="Stretch" DefaultMargins="0 10 0 0"></ext:HBoxLayoutConfig>
</LayoutConfig>
<Listeners>
<ValidityChange Handler="#{btnSave}.setDisabled(!valid);" />
</Listeners>
<Items>
<ext:Panel ID="Panel1" runat="server" BaseCls="x-plain">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch"></ext:VBoxLayoutConfig>
</LayoutConfig>
<Defaults>
<ext:Parameter Name="LabelWidth" Value="90"></ext:Parameter>
<ext:Parameter Name="Width" Value="250"></ext:Parameter>
</Defaults>
<Items>
<ext:TextField ID="tfSupplierCode" runat="server" FieldLabel="supplierCode" AllowBlank="false"></ext:TextField>
<ext:TextField ID="tfSupplierForshort" runat="server" FieldLabel="supplierForshort" AllowBlank="false"></ext:TextField>
<ext:TextField ID="tfAreaCode" runat="server" FieldLabel="areacode"></ext:TextField>
<ext:TextField ID="tfAddress" runat="server" FieldLabel="address"></ext:TextField>
</Items>
</ext:Panel>
</Items>
<Buttons>
<ext:Button ID="btnSave" runat="server" Disabled="true" Icon="DatabaseSave" Text="save" FormBind="true">
<DirectEvents>
<Click OnEvent="btnSave_Event"></Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
</div>
</form>
</body>
</html>

Daniil
May 08, 2013, 12:30 PM
Hi @hdsoso,

I would call a FormPanel's Reset method.

formSupplier.Reset();
contomSetupWindow.Show();
and remove

tfSupplierCode.Text = "";
and others.