Results 1 to 3 of 3

Thread: dialog box

  1. #1

    Default dialog box

    Hi All ,

    I am a newbie ,i have created a dialog box which has edit and cancel buttons.

    here is my code,

    Code:
    var EditLayout = function(){
        var dialog, showBtn;
        
        var toggleTheme = function(){
            Ext.get(document.body, true).toggleClass('ytheme-gray');
        };
       
        return {
            init : function(){
                 showBtn = Ext.get('show-dialog-btn');
                 // attach to click event
                 showBtn.on('click', this.showDialog, this);
                 
            },
              
            
            showDialog : function(){
                if(!dialog){ 
                    dialog = new Ext.LayoutDialog("hello-dlg", { 
                            modal:true,
                            width:600,
                            height:400,
                            shadow:true,
                            minWidth:300,
                            minHeight:300,
                            proxyDrag: true,
                            
    	                    center: {
    	                        autoScroll:true,
    	                        tabPosition: 'top',
    	                        closeOnTab: true,
    	                        alwaysShowTabs: false
    	                    }
                    });
                    dialog.addKeyListener(27, dialog.hide, dialog);
                    dialog.addButton('Edit', dialog.hide, dialog);
                    dialog.addButton('Cancel', dialog.hide, dialog);
                    
                    var layout = dialog.getLayout();
                    layout.beginUpdate();
                   
    	            layout.add('center', new Ext.ContentPanel('center', {title: 'Edit'}));
                               
    	            layout.endUpdate();
                }
                dialog.show(showBtn.dom);
            }
            
            
        };
    }();
    
    Ext.EventManager.onDocumentReady(EditLayout.init, EditLayout, true);
    	
    });
    within the dialog box i am displaying textboxes ,on click of edit button i need to validate these textboxes, how can i call a function from within this code to validate my textboxes on click of edit button?


    Thanks
    Anusha

  2. #2

    Default Solution

    Hi All,

    just in case if anyone is facing the same issue,
    we can add a handler tag and write the code required on click of edit button as shown below

    Code:
    dialog.addButton({text: 'Edit',handler: editFunction},dialog);
    dialog.addButton({text: 'Cancel'},dialog.hide,dialog);
    Thanks & Regards
    Anusha

  3. #3

    Default

    hey ,
    you can use "allowBlank:false" for not to allow blank textbox
    nand for validation you can use "vtype:alpha"

    e.g,

    new Ext.form.TextField({
    fieldLabel: 'Name',
    name: 'department_name',
    allowBlank: false,
    width:190,
    align:'right',
    vtype:'alpha'
    }),

Posting Permissions

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