TextField and Button Validation
*NEW - Coolite Toolkit Version 0.6.0 now available for download or view examples.
 

Coolite Forums

Welcome Guest ( Login | Register )
 
TextField and Button Validation
Subscribe
Last Login: Today @ 4:08:49 AM
Posts: 580,
Posted 7/7/2008 3:27:06 PM

Group: Coolite Premium Member & Early Adopter
Hello,

I've got an ExtJS TextField and a Button, the TextField is setup not to allow an empty submit however, when I click the login button it does not show the validation ... unless I click inside the TextField and lose focus.

Here is what I've got:



<ExtJS:TextField ID="txtUsername" runat="server" AllowEmpty="False" />
<ExtJS:Button ID="btnLogin" runat="server" Text="Login" CausesValidation="True" onclick="btnLogin_Click" />



Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

Last Login: Today @ 11:56:26 AM
Posts: 1,172,
Posted 7/8/2008 2:20:43 AM

Group: Core Development Team
Hi Timothy,

We're working on a sample for you, but ran into a bug. We're fixing right now. I should have a working sample for you shortly.

 I apologize for the delay.
--
Geoffrey McGill
Coolite Inc.
Core Developer
twitter [personal] [coolite]
Last Login: Today @ 4:08:49 AM
Posts: 580,
Posted 7/8/2008 4:17:10 AM

Group: Coolite Premium Member & Early Adopter
No problem, thanks for the response

The bug wouldn't be what I'm encountering would it?

Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

Last Login: Today @ 11:56:26 AM
Posts: 1,172,
Posted 7/8/2008 8:51:31 AM

Group: Core Development Team
Hi Timothy,

Ok we fixed the bug I was having problems with and I made a simple sample demonstrating how to trigger the validation and stop the postback from occurring.

<%@ Page Language="C#" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        this.Label1.Text = this.txtUsername.Text;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Coolite Toolkit - Simple Field Validation</title>
</head>
<body>
    <form id="Form2" runat="server">
    <p><a href="Validation.aspx">Reload</a></p>
        <ext:ScriptManager runat="server" StateProvider="PostBack" Theme="Gray" />
        <ext:TextField ID="txtUsername" runat="server" AllowBlank="false" />
        <ext:Button ID="btnLogin" runat="server" Text="Login" CausesValidation="True" onclick="btnLogin_Click">
            <Listeners>
                <Click Handler="
                    txtUsername.validate();
                    if (!txtUsername.isValid()) {
                        txtUsername.focus(); // if Username invalid, focus the field.
                        return false;
                    }"
                    />
            </Listeners>
        </ext:Button>
        <asp:Label ID="Label1" runat="server" />
    </form>
</body>
</html>


Are you building from SVN source? If you SVN Update, then rebuild, the above sample should work for you.

The key is calling .validate() on the TextField and then return "false" from the <Click> Handler, which will prevent the postback. Return "true" or don't return anything and the postback will happen as expected.

The example above demonstrates a manual (and granular) way of triggering the validation, although we've got a bunch of form work which should be included in the project shortly. The new work should handle all of this validation automatically. I'll keep this thread updated with our progress.

I'm also putting together a more complex sample to demonstrate multiple fields and field types.

Please let me know if you have any questions or comments and I'll do my best to help out.
--
Geoffrey McGill
Coolite Inc.
Core Developer
twitter [personal] [coolite]
Last Login: Today @ 4:08:49 AM
Posts: 580,
Posted 7/10/2008 7:13:46 AM

Group: Coolite Premium Member & Early Adopter
You have any idea when the automatic validation will take place?  Would really like to have that cleared up on a project I'm working with

Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

Last Login: Today @ 12:09:04 PM
Posts: 387,
Posted 7/10/2008 7:56:51 AM

Group: Core Development Team
Hi Timothy

Thank you for your question. As already mentioned Geoffrey, we are
working now on the FormPanel. The FormPanel will contain functionality
automatically check all fields. This will greatly simplify the code for
developers. Unfortunately, I can not say release date (or the
appearance of beta versions in svn). But we will periodically update
this topic that you were aware of progress. If automatically validation is necessary for you now please let me know and we will try to find a solution for you

Vladimir
Vladimir Shcheglov,
Coolite Inc.
Core Developer
Last Login: Today @ 4:08:49 AM
Posts: 580,
Posted 7/10/2008 8:12:05 AM

Group: Coolite Premium Member & Early Adopter
Thanks for the response again Vladsch!

Would be nice to have, but I can deal with the <asp:RequiredFieldValidation /> controls for the time being.

Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

Last Login: Today @ 4:08:49 AM
Posts: 580,
Posted 7/25/2008 7:45:04 AM

Group: Coolite Premium Member & Early Adopter
Hello,

Just wondering what the status of the automatic validation is at?

Cheers,
Timothy


----
Timothy Grant Vogelsang
tvogelsang [at] gmail [dot] com
Coolite Toolkit 0.7 SVN (Professional Edition)
Microsoft .NET Framework 2.0
Microsoft ASP.NET Ajax 1.0

« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -8:00, Time now is 12:11pm