posted March 27, 2009, last updated April 27, 2009
This is my stab at documenting the iUI interface library/framework/whatever you want to call it. I do not claim to know this fully and welcome suggestions on how to improve this documentation.
The toolbar is a div with the class of "toolbar". The definition of the right button is optional.
The main List or Div should have selected="true" as an attribute to make it the main panel
All Lists should have Ids, which are then referenced in hrefs
All Lists and Divs should have Title attirubtes, which are displayed at the top of the panels
Hrefs that are preceeded with the hash symbol (#) reference other "panels" (lists, divs, etc.) in the same html document.
To reference an external document, reference the page as normal - the page will be loaded via AJAX and inserted.
Pages loaded via AJAX should be snippets of html, not full html pages (i.e., no html or body tags). Also, note: scripts will not run when loaded in this manner.
To force a complete page replacement, make the target equal to "_self" on an anchor.
To replace an anchor with content loaded via AJAX, make the target equal to "_replace"
Note: this is a form, linked from the Search button in the toolbar, defined in Part 1. The buttons for the form are the "Cancel" button in the top-left and "Search" button in the top-right. Both "buttons" are really Anchors with Types of "Cancel" and "Submit", respectively.
Here is an example of a complex panel, containing On/Off switches (replacements for checkboxes) and input text boxes. Also note the use of Fieldset and Divs with class "row" to create the rounded border style.
Note: the labels are of a width-length, as defined in the stylesheet. Because the label will not wrap properly, you may have to override the default width for the labels on particular panels.
The current version of iui.js does not work properly when submitting forms. I made 2 changes to iui.js:
In the function "showPageByHref", change:
req.open(method || "GET", href, true);
to
req.open("POST", href, true);
Updated 04/16/2009: I have changed the "submitForm" function to the following:
function submitForm(form)
{
if (form.getAttribute("target") == "_self")
form.submit();
else
iui.showPageByHref(form.action, encodeForm(form), form.method || "POST");
}
This both fixes a problem with the showPageByHref call and adds the ability to submit a form in the normal manner by adding target="_self" to the form tag.
To capture values as you go through the menus, use the onClick event on the link to put values in a form, or pass to a javascript function.
If you have tried viewing your pages in Firefox, you'll notice the background images don't show around buttons. The buttons are drawn using the CSS attribute border-image, which Firefox does not support quite yet. Per a post from John Resig about the border-image CSS attribute, Firefox 3.1 will have border-image support. To prepare ahead of time, I recommend looking for -webkit-border-image in iui.css, duplicating the line containing it, and changing the beginning to -moz-border-image.
I was surprised the slider form element did not work on the iPhone, so after looking at this article at NextRoot about the onTouchStart, Move, and End events that replaces the mouse events on Mobile Safari, I created my own. After I clean it up, I'll add it to this page as well.
Further Experimentation (updated 04/27/2009)
I have a demo page for iUI where I have been adding enhancements - peruse it if you like.
The following enhancements have been added:
Dynamic loading of styelsheets when panel loads:
<ul stylesheet="sample.css">
Dynamic loading of script when panel loads:
<ul script="sample.js">
Defining "action button" (top-right button) per panel: