Sanjoy Roy

[MCM, MCP, SCJP] – Senior Programmer, Sites n Stores Pty Ltd.

Monthly Archives: June 2010

Flex SDK

Flex is a highly productive, open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops and operating systems. More to read from Flex SDK – Adobe Open Source

How to set TextField readOnly attribute?

Apply the follwoing extension: Code: Ext.override(Ext.form.Field, { setReadOnly: function(readOnly) { if (readOnly == this.readOnly) { return; } this.readOnly = readOnly; if (readOnly) { this.el.dom.setAttribute(‘readOnly’, true); } else { this.el.dom.removeAttribute(‘readOnly’); } } }); Now use like: Ext.getCmp(‘user_id’).setReadOnly(false); Ext.getCmp(‘user_id’).setReadOnly(true);

How to add a dynamic hidden field in a form?

Code: form.el.createChild({tag:’input’, type:’hidden’, name:’nodeId’, value: ’1′});

Changing a textfield to passwordfield dynamically

The simple way to use setAttribute(), like: { xtype: ‘button’, name: ‘p_acc_pass’, id: ‘p_acc_pass’, enableToggle : true, fieldLabel: ”, width:100, iconCls: ‘lock’, text: ‘Show Password’, toggleHandler: function(btn, st){ if(!st){ Ext.getCmp(‘p_acc_pass’).setText(‘Show Password’); Ext.getCmp(‘pass_btn’).setIconClass(‘lock’); Ext.getCmp(‘acc_pass’).getEl().dom.setAttribute(‘type’,'password’); Ext.getCmp(‘acc_pass’).getEl().addClass(‘x-form-password’); }else{ Ext.getCmp(‘pass_btn’).setText(‘Hide Password’); Ext.getCmp(‘pass_btn’).setIconClass(‘unlock’); Ext.getCmp(‘acc_pass’).getEl().dom.setAttribute(‘type’,'text’); Ext.getCmp(‘acc_pass’).getEl().addClass(‘x-form-text’); } } }

Simple AJAX Request with params as array

If you need to pass parameters to ajax request, use a single array and then assign params: array like below: var profItemLength = 0; profItemLength = profileForm.getForm().items.items.length; profData = new Array(); profData['task'] = ‘saveProfile’; profData['sid'] = SERVICE_SID; profData['acc_id'] = ACCOUNT_ID; profData['service_id'] = SERVICE_SELECTED; profData['new_username'] = NEW_USERNAME; for(var i=0; i<profItemLength; i++){ var field_type = '' field_type [...]

Form Submit with additional parameters using Sencha (ExtJS)

To submit a form with additional parameters with the form fields, config the param field array like below: profileForm.getForm().submit({ clientValidation: true, url: ‘account-processor.php’, params: { task: ‘saveProfile’, sid: SERVICE_SID, acc_id: ACCOUNT_ID, service_id: SERVICE_SELECTED, new_username: NEW_USERNAME }, success: function(form, action) { Ext.Msg.alert(‘Success’, action.result.msg); }, failure: function(form, action) { switch (action.failureType) { case Ext.form.Action.CLIENT_INVALID: Ext.Msg.alert(‘Failure’, ‘Form fields [...]

PHP Not Accepting <? Tag; Only Accepting <?php and <script> Tag

short_open_tag = boolean (php.ini file) This ‘short_open_tag’ directive determines whether or not PHP will recognize code between <? and ?> tags as PHP source which should be processed as such. It’s been recommended for several years that you not use the short tag “short cut” and instead to use the full <?php and ?> tag [...]

Photoshop Plugin for ICO Format

Photoshop Plugin for ICO Format is located at http://www.telegraphics.com.au/sw/ This plugin allows you to save files in the Windows .ico format, suitable for desktop icons and website favicons. The file should be one of the following resolutions: 16×16, 32×32 or 64×64. Download the plugin from www.telegraphics.com.au/sw/ To Install the Plugin If Photoshop is open, close [...]

Follow

Get every new post delivered to your Inbox.