2
votes

We are using Ext.Net and we have run into an issue which on the surface seems quite trivial but in practice, it would appear, requires some inside knowledge.

We are implementing a sign up form and one of the fields is the email address which will be used to uniquely identify the user.

So when the user signs up, a query is made to the database to check if the email address already exists in the system. If the email exists then we check if the email has been activated or not. If it hasn't been activated, then we want to send a message back to the front end that we the email entered was an unactivated email address.

In that case we want to pop up a confirmation window which will ask the user if the wants to activate the account or not. What we are struggling with is when to pop up the confirmation window depending upon whether the email address is activated or not.

Can anyone provide any suggestion on how to do this?

2

2 Answers

3
votes

@DavidS - I think the following sample demonstrates the entire scenario you describe.

Example

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

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<script runat="server">
    protected void Button1_Click(object sender, DirectEventArgs e)
    {
        var email = this.TextField1.Text;

        // do something to verify email...

        // assume invalid email address
        var validEmailAddress = false;

        if (!validEmailAddress)
        {
            X.Msg.Confirm("Message", "Please confirm?", new JFunction("CompanyX.Activate(result, \"" + email + "\");", "result")).Show();
        }
    }

    [DirectMethod(Namespace = "CompanyX")]
    public void Activate(string result, string email)
    {
        if (result == "yes")
        {
            var message = "Email address (" + email + ") has been ACTIVATED";

            X.Msg.Notify("Message", message).Show();
        }
    }
</script>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Ext.NET Example</title>  
</head>
<body>
    <form runat="server">
        <ext:ResourceManager runat="server" />

        <ext:TextField 
            ID="TextField1" 
            runat="server" 
            FieldLabel="Email" 
            Text="[email protected]" 
            />

        <br />

        <ext:Button 
            runat="server" 
            Text="Validate" 
            OnDirectClick="Button1_Click" 
            />

        <br />

        <ext:Label ID="Label1" runat="server" />

    </form>
</body>
</html>

Cheers!