‘javascript’ Archive

Asynchronous Tracking with Google

2 December 2009 13:43

Google Analytics has had its latest update by now allowing asynchronous tracking cools. Pretty neat and also useful if you’re suffering or concerned on page load times. Interesting to see how it would work with multiple GA accounts, but, in theory should be easy to tweak.


Filed: Technology // Tagged: , , , // 1 Comment

Prototype Validation using Ajax

5 June 2007 22:34

I’ve been using the excellent Prototype validation over at <a href=”http://tetlaw.id.au/view/javascript/really-easy-field-validation”>dexagogo</a> but recently wanted to have a a feature so as when you type a username in a sign up form it fires a real time lookup to check the username availability. After a bit of Googling and some experimentation I came up with the following. Hopefully it’ll save you some time. In this case the lookup is done via Coldfusion which encodes and returns JSON.

The form bit is pretty standard.

<div class="form-row">
<div class="field-label"><label for="field1">Username</label>:</div>
<div class="field-widget"><input name="field1" id="field1" class="text required validate-username" title="Enter yourusername." /></div>

The Javascript bit included on this page in an external JS file.

['validate-username','Sorry, that username is already taken.',function(v,elm) {
if(elm._ajaxValidating && elm._hasAjaxValidateResult) {
elm._ajaxValidating = false;
elm._hasAjaxValidateResult = false;
return elm._ajaxValidateResult;
var sendRequest = function() {
new Ajax.Request('/path/to/check/file?username='+v+'&r='+Math.random(),{
onSuccess : function(response) {
elm._ajaxValidateResult = eval(response.responseText);
elm._hasAjaxValidateResult = true;
elm._ajaxValidating = true;
return true;
return elm._ajaxValidating || Validation.get('IsEmpty').test(v) || sendRequest();

The Javascript bit in the page.

<script language="javascript" type="text/javascript">
var valid_register = new Validation('register', {immediate:true,stopOnFirst:true,onSubmit:false});

The form is submitted with an Event.observe on the submit button I have as well.

And so concludes my first geekish post for a while, it feels strangely good!

Filed: Technology // Tagged: , // 2 Comments

script.aculo.us 1.7.0

23 January 2007 12:26

A new version of script.aculo.us has now been released. It includes the final version of prototype (1.5.0) and a new Morph effect amongst other bits and bobs.

Filed: Technology // Tagged: , , , // No Comments

Firefox Release, Protoype bug fixed

20 December 2006 9:48

Firefox has been released fixing a number of security bugs but, more handily the prototype bug with object.extend is now fixed.

The original bugzilla report has the repeatable test case (see comment 4) to test.

Filed: Technology // Tagged: , , // No Comments

Object.extend problem in Firefox 2.0

26 October 2006 10:53

An annoying bug has come up post Firefox 2.0 release to do with prototype and object.extent.

A full text case can be found on the Ruby on Rails site. The bug is listed in bugzilla as well. Go vote for bug 357947 to get this sorted.

Filed: Technology // Tagged: , // No Comments

Top 10 Web Developer Libraries

26 June 2006 20:35

One of the many lists you’ll read and then forget about again, Top 10 Web Developer Libraries. Still quite useful if you’ve never seen any of the web2.0 stuff about.

Filed: General // Tagged: , , // No Comments


26 May 2005 9:40

An interesting article over at adaptive path on the changing face of web applications and how they’re moving closer to desktop applications. Examples given are Google Maps & Google Suggest. Ajax being short hand for Asynchronous JavaScript + XML. Worth a read.

adaptive path ý ajax: a new approach to web applications

Filed: Technology // Tagged: , // No Comments

Twitter   •   About   •   Contact
©2017 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset