The Wayback Machine - https://web.archive.org/web/20091016175441/http://www.yuicoder.com:80/

Simple YUI Login using Ajax, Cookies and server side auth

JavaScript [login.js]


Perl Script [login.pl]


  • Technorati Favorites
  • DZone
  • Facebook
  • Slashdot
  • Yahoo Buzz
  • Twitter
  • Yahoo Bookmarks
  • Reddit
  • Digg
  • MySpace
  • StumbleUpon
  • LinkedIn
  • Delicious
  • Blogger Post
  • Bebo
  • Furl
  • Google Reader
  • Share/Bookmark

YUI TreeView with Drag and Drop nodes

Andy created a very and useful advanced example of using the Yahoo! User Interface TreeView with the capabilites of drag and drop of child nodes to other parent nodes. Here is an exert of his blog and the link.


$coderfoo: YUI TreeView with Drag and Drop nodes

I recently had a need for a YUI (Yahoo User Interface) TreeView with Drag & Drop nodes.  Here’s a little background on the project.  My web application uses YUI Menu for navigation and is driven by a single database table.  Initially I threw together a quick and dirty CGI CRUD interface to manage the menu.  But, the more I had to modify the menu with this interface the more I needed something easier to use.  So I decided to scrap the CGI interface and start over with a nice 100% Ajax interface with a YUI TreeView to represent the YUI Menu.  Adding, changing, and deleting nodes is pretty easy, but to easily change the order of the Menu items, I added YUI Drag & Drop to the TreeView…..[MORE]

  • Technorati Favorites
  • DZone
  • Facebook
  • Slashdot
  • Yahoo Buzz
  • Twitter
  • Yahoo Bookmarks
  • Reddit
  • Digg
  • MySpace
  • StumbleUpon
  • LinkedIn
  • Delicious
  • Blogger Post
  • Bebo
  • Furl
  • Google Reader
  • Share/Bookmark

YUICalendar Helper: Creating YUI calendars using just a class name

We have all had to create calendar pop up and usually the first thing that comes to mind is “Which calendar pop-up application am i going to use?” Well, YUI certainly makes it an easy decision because it looks good and is fairly easy to create. So when the need arose to create a form which had multiple calendar controls in it (15 to be exact), I found my-self in the need of creating a way to build these calendars with-out coding and configuring these fields by hand. So that being said YUICalendar.js was created out of this need.

With YUICalendar.js you can include the file and simply specify a class name to an imput field and instantly produce a pop-up calendar. Check out the project page on Google at http://code.google.com/yuicalendar/ for more details.

Here is a working example: EXAMPLE

  • Technorati Favorites
  • DZone
  • Facebook
  • Slashdot
  • Yahoo Buzz
  • Twitter
  • Yahoo Bookmarks
  • Reddit
  • Digg
  • MySpace
  • StumbleUpon
  • LinkedIn
  • Delicious
  • Blogger Post
  • Bebo
  • Furl
  • Google Reader
  • Share/Bookmark

Creating a FIXED element with re-size and scroll detection using YUI dom and event

We have all see them and some of us love them. It’s those elements that seem to float on the page like hovering little angels. Ok enough with the sappy crap…down to business. So you need to create a browser independent simple script to position an element on a page. I put together a simple script that will handle such a task and is flexible enough for even a newbie to configure.

In this example my task is to create a footer element that will stay on the bottom of the browser window during re-size and scroll events.View the completed project\n

CSS

First you will need to specify the position and size of your element.


HTML

Assign your element an ID!


Javascript

Insert the following code to the bottom of the page just before the body tag.
In this example I am using the YUI Loader to speed up deployment of my examples. You do not need to user YUI Loader but remember you will need to load the yahoo, dom and event scripts from the YUI Library in order for this to work.


  • Technorati Favorites
  • DZone
  • Facebook
  • Slashdot
  • Yahoo Buzz
  • Twitter
  • Yahoo Bookmarks
  • Reddit
  • Digg
  • MySpace
  • StumbleUpon
  • LinkedIn
  • Delicious
  • Blogger Post
  • Bebo
  • Furl
  • Google Reader
  • Share/Bookmark

Inserting a new element before the end body tag using Yahoo Util DOM

Creating elements like divs, href links, paragraphs and more can be tricky. Suppose you do not have access to modify the html or you are dealing with a template file that is static to the entire application and need to add an element to the page on the fly. Using the YUI DOM utility you can do this simply by searching for an element by class name or id then appending the element to the page just where you want it. The code below gives you an example of how to use the getElementsByClassName method in YUI by searching for a body element with the class name of yui-skin-sam. Check out the YUI api for more helper methods.

//lets find the elements we need by finding all body elements that have the class yui-skin-sam
var elements = YAHOO.util.Dom.getElementsByClassName('yui-skin-sam', 'body');
//if you body does not have an ID then generate one usign the generateID method.
    var bodyid = YAHOO.util.Dom.generateId(elements[0],'body');
// Get the last child element of the body by searching for the body id we just created above.
    var bodyLastChild = YAHOO.util.Dom.getLastChild(bodyid);

// Now we create a DIV element using the standard javascript method createElement
		var b = document.createElement('div');
// Let YUI create and assign the new div elements id.
		var bottomid = YAHOO.util.Dom.generateId(b,'bottom');
    	b.href='#';
// Put some html in your div
		b.innerHTML = 'TESTER';
// Assign your div a class name of newClass so you can reference it in a style sheet.
		b.className = 'newClass';
// Attach the new DIV id to the element you are creating
		b.id = bottomid;
// Use YUI to insert the new div element afer the last child element of the body tag.
		YAHOO.util.Dom.insertAfter(b ,YAHOO.util.Dom.get(bodyLastChild));

Now to learn more on how to create ELEMENTS like divs and paragraphs check out the tutorials at W3cshools. This is sure to be a fun project to play and learn. Give it a try!

  • Technorati Favorites
  • DZone
  • Facebook
  • Slashdot
  • Yahoo Buzz
  • Twitter
  • Yahoo Bookmarks
  • Reddit
  • Digg
  • MySpace
  • StumbleUpon
  • LinkedIn
  • Delicious
  • Blogger Post
  • Bebo
  • Furl
  • Google Reader
  • Share/Bookmark