Linode
RSS 2.0 Feed
Posted on April 25th, 2010 at 02:32 PM by Corey Ballou

Version 0.2 of salid, a simple jquery validation plugin, has been officially released. The update includes a number of important bug fixes and optimizations. If you encounter any bugs please contact me as it benefits the community. Below is a list of the changes.

Fix to required validation function

The required validation function was not properly working with radios and checkboxes. The required function now tests whether the form elements are checked as opposed to checking for a non-existant value.

Added phone number validation

Since phone numbers are so commonly used on forms, I went ahead and added it to the list of default validation methods included with the plugin.

Fixed error display for checkboxes and radios

Due to the fact no two browsers handle checkbox and radio styling alike, the default error styling would not suffice. For starters, adding a class to the elements themselves would have no effect on their appearance as the border and background properties often cannot be overriden. For these reasons, you should now be wrapping your checkboxes and radio buttons in a

tag. The error handler will apply error styles to the parent label tag as opposed to the usual application directly on the element itself.

Fixed issue with duplicate form elements

In the event a user had multiple forms on a page that shared at least one common form element name, jQuery would only match the first element found on the page if found by ID selector. Although it is not semantically correct to have two form elements with the same ID, Salid allows for such cases to occur due to the fact numerous frameworks automatically generate ID tags based on element names. The fix involves only allowing selection from children and descendants of the form tag from which Salid was initialized.

Click here to visit the Salid project page.

Posted on February 10th, 2010 at 06:55 PM by Corey Ballou

I was vastly unaware of the number of useful functions built into Firebug beyond console.log(). The official Firebug site has a brief overview of the available commands which can be found here. Here’s a couple of quick examples to get you going.

You can use console.time() and console.timeEnd() to quickly log the time spent between the two.

console.time();
var str = '';
for (var i = 0; i < 1000; i++) {
    str += i;
}
console.timeEnd();

If you wish to profile the amount of time spent in each function call, you can use console.profile() in conjunction with console.profileEnd():

console.profile();
for (var i = 0; i < 1000; i++) {
    testFunction();
}
console.profileEnd();

function testFunction() {
    // dummy function
}

Lastly, you can call for a stack trace at any point in time by simply calling console.trace().

console.trace();