Archive for October, 2009

ExtJS Bug – Form doesn’t submit

Let me start off by saying that I love the ExtJS framework and it has been a pleasure to learn it over the last few days. It is probably the most professional JavaScript framework I've seen, thus the reason I wanted to add it to my latest app. The documentation is very thorough and it's very easy to learn.

However, I've spent most of my day (when not taking care of kids and doing school work) trying to figure out why a simple form I've created doesn't submit. The thing that really had me perplexed is that almost the exact same code worked for another form on another page. It was frustrating because I just knew it was something I was doing wrong.

Perhaps the most frustrating part about it was the fact that it was a bug in the framework itself. From what I've since found by researching on their forums, the bug was reported a few versions ago. There's a work-around and I'll get to that in a bit, but I want everyone to see the code.

var dbPanel = new Ext.form.FormPanel({
		id     			: 'dbPanel',
		name   			: 'dbPanel',
		height 			: 'auto',
		width  			: 'auto',
		standardSubmit 	        : true,
		layout 			: 'form',
		method 			: 'POST',
	        url    			: 'db_verify.php',
		border			: false,
		bbar			: tb,
		keys			: [{
		     key	: Ext.EventObject.ENTER,
		     fn 	: verifyDB
		}]
});

This is the code that doesn't work. It's a basic form and it should POST data to the db_verify.php page. The "standardSubmit : true" sets the form panel to use the old standard submit instead of Ajax. Here is another example that works:

var loginPanel = new Ext.form.FormPanel({
		id			: "loginPanel",
		height		: 'auto',
		width		: 'auto',
		layout		: 'form',
		border 		: false,
		standardSubmit	: true,
		url		: 'login.php',
		method		: 'POST',
		bbar		: tb,
		keys 		: [{
		   	key: Ext.EventObject.ENTER,
			fn : doSubmit
		}]
	});

There's very little different in these two instances of FormPanel. The only difference I could find was that the first one doesn't work and the second one does. In fact, I changed just about every option three times or more just to make sure I wasn't missing anything. Everything I did gave me the same result. The page would refresh to itself and my form data would just disappear.

The eventual fix for the problem is to manually set the DOM action for the form when the handler is fired. So, for the first code listing, my handler went from looking like this:

var verifyDB = function(){
     dbPanel.getForm().submit();
};

To looking like this:

var verifyDB = function(){
    dbPanel.getForm().getEl().dom.action = 'db_verify.php';
    dbPanel.getForm().submit();
};

The first handler worked perfectly well with the other form submit. For some reason, it just seems to randomly decide it isn't going to work for this scenario. It's an easy fixed, but when you are trying to learn a new framework it's not good to deal with a bug like this during your first few days.

, , ,

1 Comment

Why Internet Laws are Detrimental to Americans

Recently the FTC has created new guidelines/restrictions for the internet. These laws especially effect bloggers who review products. Any review of products requires a disclosure of the blogger's relationship with the product brand, if such a relationship exists. So, if you are a blogger and you review a product, if you received money or something from the product manufacturer, you now MUST disclose that information.

Now, on the outside, this appears to be a good thing. It should lower the amount of dishonesty on the internet, right? The answer is "yes and no". It will limit Americans from doing this. Americans make up about 5% of the Earth's population. Did you know that there are more people in China that speak English than there are people in the United States total? My point is, this regulation, along with many others, promotes outsourcing.

It is becoming increasingly difficult for an American to stay afloat in this world. I know, many of the non-Americans out there will say "but you guys have had it good for so long." I agree, we have. We've had it so good because we used to rely on freedom more. Our country could once pride itself on being free. We still have a lot of freedom, don't get me wrong. The fact that I'm still able to write a blog post like this reflects that I still have freedoms. They are just much more limited now when compared to even 50 years ago.

I may sound like a broken record but corporations run this country. We are losing our country.

, , ,

No Comments

Twutils.com

I've starting a new website and have almost completed development on the first tool. It's a site devoted to Twitter tools. I call it Twutils. The first utility is a spam removing tool called Spit Remover. I've settled on "Spit" as a good name for Twitter Spam. I'm in the process of moving the site to a new host due to DNS issues on the previous host. A few other ideas I have for Twutils are:
1.) Tweet Scheduler
2.) Follower generator
3.) Unfollow those that don't follow you (like Huitter.com's Mutuality.

I'm also planning to keep track of users who are removed with the spit remover. I may use this to show blacklisted spammers. I may generate a list of the most removed spammers, and allow people to remove these people automatically. Or I may just use it to create the biggest spammers list.

, ,

No Comments