var informOthersWindow; newInformOthersWindow = function (config) { this.width = 600; this.height = 200; this.title = "Andere über den Todesfall von Christina Salner informieren"; this.closeAction = 'hide'; Ext.apply(this,config); newInformOthersWindow.superclass.constructor.call(this); } Ext.extend(newInformOthersWindow,Ext.Window,{ onActionComplete : function (f, a){ if(a && a.result && a.result.success){ //var path = window.location.pathname; //path = path.substring(0, path.lastIndexOf('/') + 1); if (a.result.errors.errorMsg.length>0) { Ext.MessageBox.alert('Fehler',a.result.errors.errorMsg); } else { Ext.slide.msg('Meldung verschickt','Ihre Meldung wurde an die angegebene E-Mailadresse verschickt'); this.findById("emailRecipient").setValue(""); this.findById("captchaCode").setValue(""); this.onCapthaChange(); this.newInformOthersPanel.buttons[0].setText("Weitere Person informieren"); } //window.location = path; // Change this path to redirect to your path //window.location.reload( false ); } }, onActionFailed : function(f,a){ this.onCapthaChange(); var form = this.newInformOthersPanel.getForm(); Ext.MessageBox.alert('Fehler',a.result.errors.errorMsg); if (a.result.errors.id){ var f = form.findField(a.result.errors.id); if(f){ f.focus(); } } //Do Action when Login Failed }, onCapthaChange : function(){ var captchaURL = this.captchaURL; var curr = Ext.get('activateCodeImg'); curr.slideOut('b', {callback: function(){ Ext.get( 'activateCodeImg' ).dom.src = captchaURL+new Date().getTime(); curr.slideIn('t'); }},this); }, initComponent : function () { this.submitUrl = 'jsReturn.php'; this.captchaURL = 'templates/captcha/CaptchaSecurityImages.php?width=160&height=80&characters=4&t='; var source = this.captchaURL+new Date().getTime(); var boxCaptcha = new Ext.BoxComponent({ columnWidth:.35, autoEl: { tag:'img', id: 'activateCodeImg', title : 'Zum Neuladen bitte anklicken', src: source }, listeners : { 'click' : function () { alert('test'); } } }); boxCaptcha.on('render',function (){ var curr = Ext.get('activateCodeImg'); curr.on('click',this.onCapthaChange,this); },this); this.newInformOthersPanel = new Ext.form.FormPanel({ frame:true, //height: 100, width: 600, region : 'center', id: 'newInformOthersPanel', baseParams : { type : 'informOthersFormSend', uid : 58411 }, bodyStyle:'padding:10px', buttons : [ { id: 'btnSend', text : 'Absenden', handler: onSubmit }, { id: 'btnClose', text : 'Schließen', handler: myClose } ], items: [ { layout : 'column', items : [ { layout : 'form', columnWidth:.65, layoutConfig: { labelSeparator: '' } ,items : [ /* { fieldLabel: 'Email Address ', name: 'user', xtype : 'textfield', value: 'amemorablejourney@yahoo.com' ,anchor:'90%' }, { fieldLabel: 'Password ', xtype : 'textfield', inputType: 'password', name: 'pass', value : 'wahanailmu.wordpress.com', anchor:'90%' } , */ { id: 'entryName', fieldLabel: 'Ihr Name', name: 'name', xtype: 'textfield', maxLength: 100, maxLengthText: 'Bitte verwenden Sie 100 oder weniger Zeichen.', //allowBlank: false, anchor:'90%' }, { id: 'emailRecipient', fieldLabel: 'E-Mail des Empfängers', name: 'emailRecipient', xtype: 'textfield', //vtype: 'email', maxLength: 100, maxLengthText: 'Bitte verwenden Sie 500 oder weniger Zeichen.', anchor:'90%' }, { id: 'captchaCode', fieldLabel: 'Code von rechts', name: 'code', xtype : 'textfield', anchor:'50%' } ] } ,boxCaptcha ] } ] ,listeners: { 'actioncomplete': { fn: this.onActionComplete, scope: this }, 'actionfailed': { fn: this.onActionFailed, scope: this } } ,url: this.submitUrl }); var form = this.newInformOthersPanel.getForm(); function onSubmit() { form.submit({ //reset : true }); }; function myClose() { form.reset(); informOthersWindow.hide(); }; this.layout = "border"; this.items = [ this.newInformOthersPanel ]; newInformOthersWindow.superclass.initComponent.call(this); } }); Ext.onReady(function () { informOthersWindow = new newInformOthersWindow(); //loginwindow.show(); });