Ask for confirmation before calling direct method

  1. #1

    Ask for confirmation before calling direct method

    So my direct method works fine like this:

                                            
    <Listeners>
        <Click Handler="if(confirm('Are You Sure?'))Ext.net.DirectMethods.CreateType({
                           success: function (result) {Ext.Msg.alert('Manager', result);}});" />
    </Listeners>
    But if i don't use the built in javascript "confirm" method and instead use an Ext method, it doesn't work. The code within the confirmCreate fires, but CreateType does not appear to fire...little help?

    <Listeners>
           <Click Handler="if(confirmCreate())Ext.net.DirectMethods.CreateType({
                            success: function (result) {Ext.Msg.alert('Manager', result);}});" />
    </Listeners>
    <script language="javascript" type="text/javascript">
        function confirmCreate() {
    
            Ext.Msg.confirm('Confirm', 'Really?', function (btn, text) {
                if (btn == 'yes') {return true;}
                return false;
            })
        }
    </script>
    Any help would be appreciated
  2. #2
    <Listeners>
           <Click Handler="confirmCreate();" />
    </Listeners>
    <script language="javascript" type="text/javascript">
        function confirmCreate() {
            Ext.Msg.confirm('Confirm', 'Really?', function (btn, text) {
                if (btn == 'yes') {
                    Ext.net.DirectMethods.CreateType({
                            success: function (result) {
                                    Ext.Msg.alert('Manager', result);
                            }
                    })
                }
            });
        }
    </script>
  3. #3

    Thank You!

    Quote Originally Posted by nightik View Post
    <Listeners>
           <Click Handler="confirmCreate();" />
    </Listeners>
    <script language="javascript" type="text/javascript">
        function confirmCreate() {
            Ext.Msg.confirm('Confirm', 'Really?', function (btn, text) {
                if (btn == 'yes') {
                    Ext.net.DirectMethods.CreateType({
                            success: function (result) {
                                    Ext.Msg.alert('Manager', result);
                            }
                    })
                }
            });
        }
    </script>
    Dang it! I was going to reply and say i tried it this way and it didn't work - because i did...but i must have had a syntax error that didn't bubble up when i tried it like this....thank you!!! Maybe i should look into using the debug version of the javascript code.

    thanks again.....

Similar Threads

  1. Replies: 0
    Last Post: Mar 08, 2012, 9:45 AM
  2. Replies: 3
    Last Post: Dec 28, 2011, 5:46 PM
  3. Replies: 2
    Last Post: Oct 12, 2011, 7:49 AM
  4. Success function in calling Direct Method..help!
    By Aleksa007 in forum 1.x Help
    Replies: 2
    Last Post: Jul 26, 2011, 4:36 PM
  5. Replies: 1
    Last Post: Mar 11, 2011, 2:54 PM

Tags for this Thread

Posting Permissions