Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

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:

Ext.override(Ext.form.Field, {
    setReadOnly: function(readOnly) {
        if (readOnly == this.readOnly) {
        this.readOnly = readOnly;

        if (readOnly) {
            this.el.dom.setAttribute('readOnly', true);
        } else {

Now use like:


How to add a dynamic hidden field in a form?

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: '',
iconCls: 'lock',
text: 'Show Password',
toggleHandler: function(btn, st){
 Ext.getCmp('p_acc_pass').setText('Show Password');
 Ext.getCmp('pass_btn').setText('Hide Password');

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 = profileForm.getForm().items.itemAt(i).getEl().dom.type;
    if(field_type != 'button'){
	var field_id = '';
	    field_id = profileForm.getForm().items.itemAt(i).getEl();
	var field_value = '';
	    field_value = profileForm.getForm().items.itemAt(i).getEl().getValue();
	if(field_type == 'checkbox'){
	    if (profileForm.getForm().items.itemAt(i).checked == true) field_value = 'on'; else field_value = '';
	profData[field_id]     = field_value;

    waitMsg: 'Saving profile...',
    url: 'account-processor.php',
    params: profData,
    callback: function (options, success, response) {
    if (success) {
	var json = Ext.util.JSON.decode(response.responseText);
	   Ext.MessageBox.alert('Add Profile Info', json.msg);

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:

    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 may not be submitted with invalid values');
            case Ext.form.Action.CONNECT_FAILURE:
                Ext.Msg.alert('Failure', 'Ajax communication failed');
            case Ext.form.Action.SERVER_INVALID:
               Ext.Msg.alert('Failure', action.result.msg);

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 combination. With the wide spread use of XML and use of these tags by other languages, the server can become easily confused and end up parsing the wrong code in the wrong context. But because this short cut has been a feature for such a long time, it’s currently still supported for backwards compatibility, but it is recommend we don’t use them.
Default Value: On
Development Value: Off
Production Value: Off

short_open_tag = On

for more info, visit:

Photoshop Plugin for ICO Format

Photoshop Plugin for ICO Format is located at

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
To Install the Plugin

If Photoshop is open, close it.

Extract the downloaded file (e.g. unzip it in Windows) and move the plugin file to your Photoshop Plug-Ins folder, under File Formats. The default location of this folder in Windows is shown on the right.

Note: The plugin file will will have a name that begins with ICOFormat.

Start Photoshop.

Create or open a file with one of the correct dimensions (see above) and select File > Save > As.

You can now choose .ico as one of the format options.

%d bloggers like this: