Results 1 to 2 of 2

Thread: Problem with Button!

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    13
    Vote Rating
    0
      0  

    Question Problem with Button!

    I have following code:
    Code:
      Ext.BLANK_IMAGE_URL = './ext/resources/images/default/s.gif';
    
       Ext.onReady(function(){   
    
            Ext.QuickTips.init(); 
    
                            var addQuestionForm = new Ext.form.FormPanel({
                                    frame       :true,
                                    method      : 'POST',                                                                             
                                        items: [ 
                                                {
                                                     xtype      :'htmleditor',
                                                     width      : "99%",
                                                     height     : 200,
                                                     fieldLabel :'Question',
                                                     name       :'question[text]',
    
                                                }                       
                                    ],
    
    
                                buttonAlign: 'center',
                                    buttons: [{
                                            text            : 'Submit', 
                                            height          : 30,               
                                            icon            : '/images/icons/silk/accept.png',
                                            scale           : 'large',
                                            width           : 500,
                                            handler         : function(){
                                                    if(addQuestionForm.getForm().isValid()){ 
                                                            addQuestionForm.getForm().submit({
                                                              //  url:'/answers/create',
                                                              //  waitMsg: 'Please wait...',
                                                                  success : function(form, action) {
                                                                    Ext.MessageBox.alert('Success!', 'Good job!');
                                                                //  surveyWindow.close();
                                                                    var redirect = '/admin/private_zone'; 
                                                                    window.location = redirect;                                                         
                                                                },
                                                                failure: function(form, action){
                                                                    Ext.MessageBox.alert('Failure!', action.result.msg);
                                                                    }                                      
                                                            });
                                                    }
                                }
                              },
                              {
                                text:'Cancel',
                                handler: function(){
                                     var redirect = '/admin/private_zone'; 
                                     window.location = redirect;        
                                }
                            }]
    
                            });
    
                            var addQuestionWindow = new Ext.Window({
                                    title       : 'Add Question',
                                    layout      : 'form',
                                    id          : 'id-form',
                                    width       : 800,
                                    height      : 800,
                                    modal       : true,
                                    closable    : false,
                                    resizable   : false,
                                    draggable   : false,
                                    autowidth   : true,
                                    closeAction : 'hide',
                                    bodyStyle   : 'padding: 10px',
                                    items       : [addQuestionForm]                     
    
                            });
    
                            addQuestionWindow.show();
    
        });
    Problem is: When i press "ADD" button, firstly nothing happens and secondly I retur on my login page where i should write login & password. WTF? SO i think session is destroyed when i press button ? How to avoid this? Don;t understand. Maybe something wrong with my code in button?

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    86
      0  

    Default

    Ext.MessageBox.alert is non blocking, so your window.location will fire!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •