How-To

Web page performance is critical to keeping customers and visitors moving along on your site. Slow responses typically result in frustrated users, unhappy customers and worse, abandoned orders. It is important to reduce the number of requests generated by a web page in order to increase its actual and perceived performance.

One critical way is to reduce the number of external files loaded by a page. Another one is to reduce their size through compression. This post aims to take this concept a step further by automating this tedious process using open-source libraries.

[click to continue…]

{ 0 comments }

As you might already know, despite looking like a typical select box, Ext.form.ComboBox doesn’t behave exactly as you would expect since it submits the display text instead of the option value. The documentation states:

A ComboBox works in a similar manner to a traditional HTML <select> field. The difference is that to submit the valueField, you must specify a hiddenName to create a hidden input field to hold the value of the valueField. The displayField is shown in the text field which is named according to the name.

this.add([
	{
		xtype: 'combo',
		name: 'suffix',
		hiddenName: 'suffixId', // post this name
		hiddenValue: 0, // default value
		fieldLabel: 'Suffix',
		mode: 'local',
		store: this.suffixStore,
		valueField: 'key',
		displayField: 'display',
		triggerAction: 'all',
		forceSelection: true,
		allowBlank: true
	}
]);

Adding a hiddenName and a default value in hiddenValue does the trick, the default value (0) is set in the hidden field until a user chooses a different value. Unfortunately this breaks when the ComboBox is set to allow blanks and the user tabs over the field. When this happens, the hiddenValue is set to a null string and the user is never prompted to select a value.

Upon form submission, the hiddenField (suffixId) will be set to neither the default nor a valid value.

One solution is to listen for the focus and blur events to reset the value of the hidden field when it has been set to a null string.

this.add([
	{
		xtype: 'combo',
		name: 'suffix',
		hiddenName: 'suffixId',
		hiddenValue: 0,
		fieldLabel: 'Suffix',
		mode: 'local',
		store: this.suffixStore,
		valueField: 'key',
		displayField: 'display',
		triggerAction: 'all',
		forceSelection: true,
		allowBlank: true,
		listeners: {
			'focus': this.handleSuffixChange,
			'blur': this.handleSuffixChange,
			scope: this
		}
	}
]);

handleSuffixChange: function(field) {
	if (field.value=='') {
		field.hiddenField.value = '0';
	}
}

Upon form submission you will be guaranteed a valid value, which is especially beneficial if you’re using the form values to populate a server side bean object.

{ 1 comment }

Is My Mac’s SuperDrive Dead?

For the last couple of weeks I’ve been unable to burn DVDs on my MacBook Pro. I insert a blank disc whenever the SuperDrive prompts for one, it then checks and checks for about a minute before ejecting the disc. At first I thought this was related to the type of disc I was using, [...]

Read the full article →

Force a URL to Use HTTPS

Thumbnail image for Force a URL to Use HTTPS

Site owners sometimes need to make sure secure connections are used. They can do this quickly with this Apache rule.

Read the full article →

iTunes Crashes During Sync Post 2.2.1 Upgrade – FIX

Thumbnail image for iTunes Crashes During Sync Post 2.2.1 Upgrade – FIX

Keep iTunes from crashing after the iPhone/iPod Touch 2.2.1 upgrade.

Read the full article →

Build Your First Ext-JS in Under an Hour

The Visual Ajax User Group is hosting a webinar with Aaron Conran, Sr. Architect Ext-JS on Thursday, October 16th, 2008. Sign up now.

Read the full article →

Creating an Apple Style Menu with Animation

Kriesi Budschedl has posted a very detailed tutorial to help you build your own Apple.com style menu and adds a nice touch by animating it.

Read the full article →

Google Maps Component for Ext-JS

Shea Frederick has created a user-defined extension to integrate Google Maps with ExtJS.

Read the full article →

Improving Performance by Combining Scripts and CSS

According to the Yahoo! performance team, the best way to improve your web site’s performance is to reduce the number of requests for assets such as scripts, style sheets and images. One way to accomplish this is by combining all the script files into one and serving only that file in your production environment. The [...]

Read the full article →

To Love One’s Craft: Fun with grep and RegEx…

I just read an interesting post by Dave Nelson (spugbrap) in which he details all the fun he had writing a script to search through Ext JS source code and open it with Textpad. So, I checked the TextPad help to see if I could pass in the name of a file containing full file [...]

Read the full article →