[SOLVED] How can I know if a PanelForm is valid when the text of a TextField changes using code behind?
New Community Forums available at http://forums.ext.net
 

Coolite Forums

Welcome Guest ( Login | Register )
 
123»»»
[SOLVED] How can I know if a PanelForm is...
Subscribe
Last Login: 7/1/2010 5:02:55 PM
Posts: 358,
Posted 6/24/2010 9:24:13 AM

Group: Coolite Premium Member & Early Adopter
Hi,

How can I know if a PanelForm is valid when the text of a TextField changes using code behind?


Flor Maria
Last Login: 7/1/2010 5:02:55 PM
Posts: 358,
Posted 6/24/2010 9:55:07 AM

Group: Coolite Premium Member & Early Adopter
 Hi,

Also I need to know if there is any event in the FormPanel that is triggered inmediacly when the FormPanel gets valid.




Flor Maria
Last Login: 7/5/2010 5:02:39 AM
Posts: 67,
Posted 6/24/2010 10:29:19 AM

Group: Coolite Premium Member & Early Adopter
Hello, Flor Maria!

Please look at the example.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="How can I know if a PanelForm is valid when.aspx.cs"
    Inherits="Work.Premium_help.How_can_I_know_if_a_PanelForm_is_valid_when" %>

<script runat="server">
    [DirectMethod]
    public void ChangeText()
    {
        this.TextField3.Text = "1@1.com"; ;
    }
</script>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>FormPanel Validation - Ext.NET Examples</title>
    <style type="text/css">
        .icon-exclamation
        {
            padding-left: 25px !important;
            background: url(/icons/exclamation-png/ext.axd) no-repeat 3px 3px !important;
        }
        .icon-accept
        {
            padding-left: 25px !important;
            background: url(/icons/accept-png/ext.axd) no-repeat 3px 3px !important;
        }
    </style>
</head>
<body>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:FormPanel ID="FormPanel1" runat="server" Title="FormPanel Validation (all fields required)"
        MonitorPoll="500" MonitorValid="true" Padding="5" Width="600" Height="250" ButtonAlign="Right"
        Layout="Column">
        <Items>
            <ext:Panel ID="Panel1" runat="server" Border="false" Header="false" ColumnWidth=".5"
                Layout="Form" LabelAlign="Top">
                <Defaults>
                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                    <ext:Parameter Name="MsgTarget" Value="side" />
                </Defaults>
                <Items>
                    <ext:TextField ID="TextField1" runat="server" FieldLabel="First Name" AnchorHorizontal="92%" />
                    <ext:TextField ID="TextField1_" runat="server" FieldLabel="Company" AnchorHorizontal="92%" />
                </Items>
            </ext:Panel>
            <ext:Panel ID="Panel2" runat="server" Border="false" Layout="Form" ColumnWidth=".5"
                LabelAlign="Top">
                <Defaults>
                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                    <ext:Parameter Name="MsgTarget" Value="side" />
                </Defaults>
                <Items>
                    <ext:TextField ID="TextField2" runat="server" FieldLabel="Last Name" AnchorHorizontal="92%" />
                    <ext:TextField ID="TextField3" runat="server" FieldLabel="Email" Vtype="email" AnchorHorizontal="92%" />
                </Items>
            </ext:Panel>
        </Items>
        <Buttons>
            <ext:Button ID="Button3" runat="server" Text="Change the text">
                <Listeners>
                    <Click Handler="Ext.net.DirectMethods.ChangeText({
                                        success: function (result) {
                                            if (#{FormPanel1}.getForm().isValid()) {Ext.Msg.alert('Valid', 'The Form is valid!');}else{Ext.Msg.alert('Invalid', 'The Form is invalid!');}
                                        }
                                    });" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="Button1" runat="server" Text="Save">
                <Listeners>
                    <Click Handler="if (#{FormPanel1}.getForm().isValid()) {Ext.Msg.alert('Submit', 'Saved!');}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="Button2" runat="server" Text="Cancel" />
        </Buttons>
        <BottomBar>
            <ext:StatusBar ID="StatusBar1" runat="server" />
        </BottomBar>
        <Listeners>
            <ClientValidation Handler="el.getBottomToolbar().setStatus({text : valid ? 'Form is valid' : 'Form is invalid', iconCls: valid ? 'icon-accept' : 'icon-exclamation'});" />
        </Listeners>
    </ext:FormPanel>
</body>
</html>


The base of this example is http://examples.ext.net/#/Form/FormPanel/Validation/.

So, to know the FormPanel is valid when the text of a TextField is changed using code behind you can use the DirectMethod with the success handler. For more information about the DirectMethods please follow the link http://examples.ext.net/#/Events/DirectMethods/Overview/.

You can use the
ClientValidation event to check the valid state. This event fires repetitively to notify of valid state. You can see the Handler of the CheckValidation in the example.

Hope this helps.

--
Best wishes,
Daniil Veriga

Last Login: 7/1/2010 5:02:55 PM
Posts: 358,
Posted 6/24/2010 11:12:16 AM

Group: Coolite Premium Member & Early Adopter
Hi,

I am trying to make the button ImageButtonNext disable=false after the FormPanel gets valid, but it does not work.

Could you tell me please what I am doing wrong?






<Listeners>


<ClientValidation Handler="el.getImageButtonNext().setDisabled({text : valid ? true:false});" />


</Listeners>



<ext:ImageButton ID="ImageButtonNext" runat="server" Disabled="true"


ImageUrl="App_Themes/ChampWeb/Images/imaBtnStandar_Next_Out.png">


</ext:ImageButton>


 

Flor Maria
Last Login: 7/5/2010 10:10:13 AM
Posts: 7,853,
Posted 6/24/2010 11:30:48 AM

Group: Core Development Team
Hi,

It was a problem with setDisabled method. Now it is fixed. Please update from SVN 

--
Vladimir Shcheglov
Coolite Inc.
Development Team
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
Last Login: 7/1/2010 5:02:55 PM
Posts: 358,
Posted 6/24/2010 11:42:41 AM

Group: Coolite Premium Member & Early Adopter

Hi,

I noticed that there are new directories after update from SVN.

Could you tell me please how to update my project with this version?


Flor Maria
Last Login: 7/5/2010 10:10:13 AM
Posts: 7,853,
Posted 6/24/2010 11:46:47 AM

Group: Core Development Team
Hi,

What directories do you mean? You have to update from SVN, open the solution in the VS (Ext.Net.2008.sln or Ext.Net.2010.sln, depends from VS version) and rebuild. Then add new assemblies to your application

--
Vladimir Shcheglov
Coolite Inc.
Development Team
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
Last Login: 7/1/2010 5:02:55 PM
Posts: 358,
Posted 6/24/2010 12:05:54 PM

Group: Coolite Premium Member & Early Adopter
Hi,

I got the error attached after compiling the solutions:

-Coolite.Toolkit 

-Coolite.Toolkit.install

Also after compile do I take the dlls file from the following location?

Coolite.Ext.Web\bin\Release

Also I do not see the Coolite.Ext dll after updating from SVN and I think now is Coolite.Ext.Web it is that right?








Flor Maria
Post Attachments
ErrorBuildingPorject.PNG (3 views, 99.82 KB)
Last Login: 7/5/2010 10:10:13 AM
Posts: 7,853,
Posted 6/24/2010 12:13:01 PM

Group: Core Development Team
Hi,

What version of the toolkit do you use? If 1.0 then please use the following SVn Url
http://svn.coolite.com/toolkit/branches/1.0.0

For 0.8.3 please use
http://svn.coolite.com/toolkit/trunk 

--
Vladimir Shcheglov
Coolite Inc.
Development Team
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
Last Login: 7/1/2010 5:02:55 PM
Posts: 358,
Posted 6/24/2010 12:33:39 PM

Group: Coolite Premium Member & Early Adopter
Hi,

I got the attached error opening the solution "Ext.Net.2008"

Flor Maria
Post Attachments
ErrorScreen.PNG (3 views, 64.15 KB)
« Prev Topic | Next Topic »
123»»»
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -5:00, Time now is 1:23pm