[CLOSED] MessageBox prompt with required field

  1. #1

    [CLOSED] MessageBox prompt with required field

    Is it possible to make the prompt textbox a required field such that the Ok/Yes button is disabled until something is typed into it?
    Last edited by Daniil; Feb 24, 2012 at 5:00 AM. Reason: [CLOSED]
  2. #2
    Hi,

    There is no such built-in functionality.

    Though it's possible.

    Example
    <%@ Page Language="C#" %>
     
    <%@ 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 runat="server">
        <title>Ext.NET Example</title>
    
        <script type="text/javascript">
            var showPrompt = function () {
                Ext.Msg.prompt("Title", "Message");
    
                var d = Ext.Msg.getDialog(),
                    textEl = d.body.child(".ext-mb-input"),
                    btnOk = d.buttons[0],
                    btnCancel = d.buttons[3];
    
                btnOk.disable();
                btnCancel.disable();
    
                textEl.on(
                    "keyup", 
                    function (e, t) {
                        var disabled = t.value.length < 1;
       
                        btnOk.setDisabled(disabled);
                        btnCancel.setDisabled(disabled);
                    },
                    null,
                    {
                        buffer : 250
                    }
                );
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Button runat="server" Text="Prompt">
                <Listeners>
                    <Click Fn="showPrompt" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    It might be best to implement your own window to achieve the requirement.
  3. #3
    Thank you. this gives me a good start.

Similar Threads

  1. Required Field Validation
    By t0ny in forum 1.x Help
    Replies: 10
    Last Post: Aug 25, 2014, 1:01 PM
  2. Replies: 9
    Last Post: Nov 23, 2012, 4:13 AM
  3. [CLOSED] Messagebox prompt set cursor position to end
    By jchau in forum 1.x Premium Help
    Replies: 5
    Last Post: Jan 20, 2010, 12:40 AM
  4. Custom Prompt MessageBox
    By EzaBlade in forum 1.x Help
    Replies: 2
    Last Post: Nov 04, 2009, 12:14 PM
  5. [CLOSED] FormPanel required field
    By turione in forum 1.x Premium Help
    Replies: 6
    Last Post: Aug 20, 2009, 3:33 PM

Posting Permissions