[CLOSED] MessageBoxConfig - add extra parameters in MultiLine alert/messageBox

  1. #1

    [CLOSED] MessageBoxConfig - add extra parameters in MultiLine alert/messageBox

    Hey!

    I want to add a parameter to the call in a MessageBox. Instead of just doing this (as can be seen here):

    X.Msg.Show(new MessageBoxConfig
                {
                    Title = "Do the thing?",
                    Message = "Some nice instructions.",
                    Width = 300,
                    Buttons = MessageBox.Button.OKCANCEL,
                    Multiline = true,
                    Fn = new JFunction { Fn = "confirmResult" }
                });
    I want to add a paramter, and I suspect I need to use Handler instead of Fn??

    X.Msg.Show(new MessageBoxConfig
                {
                    Title = "Do the thing?",
                    Message = "Some nice instructions.",
                    Width = 300,
                    Buttons = MessageBox.Button.OKCANCEL,
                    Multiline = true,
                    Fn = new JFunction { Handler="confirmResult(" + b.Id + ", btn, text)" }
                });
    However, I get that "btn" is not defined. How can I do this? =) thx!
    Last edited by Daniil; Apr 21, 2011 at 8:01 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please see xml comments for the Fn property
    /// <summary>
    /// A callback function which is called when the dialog is dismissed either by clicking on the configured buttons, or on the dialog close button, or by pressing the return button to enter input.
    /// Progress and wait dialogs will ignore this option since they do not respond to user actions and can only be closed programmatically, so any required function should be called by the same code after it closes the dialog. Parameters passed:
    /// buttonId : String
    /// The ID of the button pressed, one of:
    /// ok
    /// yes
    /// no
    /// cancel
    /// text : String
    /// Value of the input field if either prompt or multiline is true
    /// </summary>
    So, you have to use 'buttonId' and 'text'
    Fn = new JFunction { Handler="confirmResult(buttonId, text)" }
  3. #3
    I think you misunderstood me. The "b.Id" in my example is not the button id, it is my internal ID-number of one of my objects.

    So I need to pass my own variable, so that the next step can be taken. I cannot take the next step if I dont know the ID-number of my object.

    I tried the following:

    Fn = new JFunction { Handler="confirmResult(" + b.Id +", buttonId, text)" }
    but I get

    Uncaught ReferenceError: buttonId is not defined
  4. #4
    Hi wagger,

    To add any custom parameters, please use .Handler instead of .Fn.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Show(object sender, DirectEventArgs e)
        {
            X.Msg.Show(new MessageBoxConfig
            {
                Title = "Do the thing?",
                Message = "Some nice instructions.",
                Width = 300,
                Buttons = MessageBox.Button.OKCANCEL,
                Multiline = true,
                Handler = "confirmResult(buttonId, text, 'someParam');"
            });
        }
    </script>
    
    <!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 confirmResult = function (buttonId, text, someParam) {
                alert(buttonId + " " + text + " " + someParam);
            }
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Button runat="server" Text="Show" OnDirectClick="Show" />
        </form>
    </body>
    </html>
  5. #5
    Thanks, that helped!

Similar Threads

  1. [CLOSED] Extra Parameters in Textfields
    By trezv in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 03, 2012, 3:24 PM
  2. Need Help : MessageBox setIcon() not working on Alert()
    By santhu12smart in forum 1.x Help
    Replies: 6
    Last Post: Dec 09, 2011, 12:10 PM
  3. Replies: 0
    Last Post: Sep 05, 2011, 4:11 AM
  4. Listener Fn - How can I pass extra parameters?
    By lionelhutz in forum 1.x Help
    Replies: 0
    Last Post: Dec 10, 2009, 5:25 PM
  5. Extra parameters Ajax Method from a Text Field
    By davromu in forum 1.x Help
    Replies: 4
    Last Post: Jun 17, 2009, 3:27 PM

Tags for this Thread

Posting Permissions