erichynds

Welcome to my online development portfolio and blog. I'm Eric Hynds, a 23 year old website developer living outside of Boston, Massachusetts, and I'm passionate about developing functional, standard-compliant, and user-friendly websites.

Archive for June, 2009

Changes to TabBasket.com

Wednesday, June 24th, 2009

I just pushed live a ton of changes to my TabBasket application. I upgraded Rails on my slice, installed postfix so now the password recovery/welcome e-mails actually go out, update the design quite a bit, and added the jQuery tablesorter plugin to the tab listing page. It looks a hell of a lot better now than it did before. Coming next are the paging and filtering widgets for the tablesorter, and a tagging system which is now partially integrated.

jQuery: modifying the submit button when a form is submitted

Friday, June 19th, 2009

I’ve found it useful on certain apps to disabled the submit button once the form has been submitted to prevent the user from accidentally/deliberately clicking on it twice. There are two ways to accomplish this, and only one will work in IE. Can you guess which one?

$("form :submit").click(function(){
	$(this).attr("disabled", "disabled").val("Please wait...");
});
$("form").submit(function(){
	$(":submit", this).attr("disabled","disabled").val("Please wait....");
});

See this example in action

In the first example, the submit button will be disabled, its value will be changed, but the form will not submit. Adding a return true; statement will not fix the issue. In the second example, all the behaviors you would expect work in Firefox and IE.

I did some investigating and could not come up with an answer. With the first example you could call a .submit() directly on the form, but this should not be necessary. So, if you want to manipulate the submit button once the form has been submitted, intercept the submit event on the form instead of intercepting the click on the button itself.

CFIMAGE resize after CFFILE upload

Friday, June 12th, 2009

I ran into an issue today while trying to resize an image with CFIMAGE that was just uploaded with CFFILE. Apparently there are (were) a number of bugs when these two tags are used in succession. In my case, the image would be uploaded fine, and then magically be deleted by the CFIMAGE tag, at which point an error would be thrown because the file could not be found.

Code:

<!--- upload image --->
<cffile action="upload" 
	destination="#expandpath("/images/sales/")#"
	filefield="image"
	nameconflict="makeunique">
 
<!--- resize it --->
<cfimage action="resize" 
	width="640" 
	height="480" 
	source="#expandpath("/images/sales/#file.serverfile#")#"
	destination="#expandpath("/images/sales/#file.serverfile#")#"
	overwrite="yes">

Turns out there is a simple (hot)fix for this: http://kb2.adobe.com/cps/403/kb403411.html