Michael Gaigg: Über UI/UX Design

20Dec0

Highlights for Week 50/2011

Posted by Michael Gaigg

16Jul0

Highlights of Week 28/2011

Posted by Michael Gaigg

28Mar0

JavaScript Pop-ups – Good or Bad?

Posted by Michael Gaigg

Having witnessed a recent discussion on the WAI Interest Group list I asked myself, are JavaScript Pop-ups good or bad (or evil)?

Conclusion

It depends. But mostly bad 😉

Con's

John Colby's from Birmingham City University arguments on why pop-ups are bad:

  1. Because people are warned about them (http://www.bbc.co.uk/webwise/guides/about-popups)
  2. Because of their association with scams, viruses, malware, sites using popups are 'less trustworthy'
  3. Users with sight or cognitive problems (http://soap.stanford.edu/show.php?contentid=47)
  4. (And personally) if they insist on using popups I'll go away.

Richard from Userite remembers us that:

...the pop-up almost certainly takes the focus away from the current window. Blind users will not know this unless you tell them AND provide a clear method to close the pop-up and return the user to the point immediately after where the pop-up activated. Also remember to provide a text based alternative for those who do not have javascripting.

with Charles McCathieNevile from Opera adding:

...that many users have pop-ups blocked by default now, so won't actually see it even if they are not blind.

Pro's

Harry Loots of the IEEE has a point when he says:

If it will supply useful information to the user, then don't kick against it, but make sure that the feedback / information so provided is accessible. For example, if the pop-up is used to confirm the product has been added and the user's browser does not support scripting/popups, a physical line of text may be displayed to confirm the product has been added (which can be hidden in the view seen by users who get the popup)

My Take

When a client asks for a specific design element, one needs to wonder where this need came from in the first place.

In the case that the client is not satisfied with visibility of system status. Try

  • Improving titles and labels
  • Adding non-obstructive instructions
  • Providing feedback in an alternative way (as Harry pointed out), additional confirmation page always helps
  • Keeping elements and its status (e.g. shopping cart belongs to the top right corner) in its user-anticipated location
  • Using visual cues to show what just happened
9Nov0

Web GIS: Principles and Applications [Paperback]

Posted by Michael Gaigg

Web GIS

Web GIS


I'm happy to introduce a new book which was co-authored by my colleague Pinde Fu: "Web GIS: Principles and Applications".

I'm really excited about this, not only because good GIS resources are scarce but also because he used screenshots of applications that I have designed over the past years, e.g. geodata.gov, GeoPortal Toolkit, Loma Linda Medical Center Response System, HydroViewer.

How much better can it get when your design ends up in a book?

Audience

While the content of the book is targeted at readers at all skill levels I can see it as a great teaching source as well as invaluable resource for managers and aspiring GIS developers to understand the principles of web applications.

Content

The content of the book is focused on the conceptual level (you won't find code samples) by trying to be systematic and as comprehensive as possible which I believe was done superbly. Nevertheless the authors do cover important new developments like geospatial Web services (REST), geobrowsers, cloud computing, geoportals, mashups, mobile GIS, Gov 2.0, geotagging, ArcGIS APIs for JavaScript, Flex, and Silverlight.

Table of Contents

  1. GIS in the Web Era
  2. Technical Basics
  3. Geospatial Web Services
  4. Geospatial Mashups
  5. Mobile GIS
  6. Geoportals
  7. NSDI in the Web 2.0 Era
  8. Web GIS Applications in E-Business
  9. Web GIS Applications in E-Government
  10. Hot Topics and New Frontiers
Suggested reading:
5Oct0

Templates for Building Map Applications with ArcGIS API for JavaScript

Posted by Michael Gaigg

Templates for ArcGIS API for JavaScript

Templates for ArcGIS API for JavaScript

Creating web mapping applications has never been easier.

Esri offers a multitude of API's, from Silverlight to Flex and JavaScript.

Without discussing the design approach for your particular user-specific needs, I want to point to some great template resources that can serve as a starting point for customizing your app. The templates are based on ArcGIS Explorer Online viewer.

Follow this really nice tutorial on how to access the template gallery to get started.

1Aug0

Highlights of Week 30/2010

Posted by Michael Gaigg

29Mar0

jQuery: Handle Dropdown (select), Checkboxes and Radio selections

Posted by Michael Gaigg

Almost daily I work with lists, be it dropdown, checkbox or radio selections. I need to select values, submit selections, hide/show containers depending on the selection etc.

I tend to forget all these cool jQuery notations that make every programmers life easier. How nice would it be to have a little cheat sheet? So I decided to summarize my findings (and share them with you).

Obviously jQuery is powerful and gives you a multitude of possibilities so this list is neither exhaustive nor covers all possible application scenarios. Mix, match, combine and extend the samples as you wish and feel free to post your additional solutions in the comments section.

See the test page.

Dropdown

I'm using the following sample list:

<select id="ddlCategories"> 
   <option>- Select a category -</option>
   <option value="books" selected="selected">Books</option>
   <option value="videos">Videos</option>
   <option value="dvds">DVDs</option>
</select>

Get value of selected item

Pure and simple, despite what you might read in other tutorials:

alert("Selected value: " + $("#ddlCategories").val());

Change text of a particular item

Let's target item with value 'videos':

$("#ddlCategories option[value='videos']").text("Videos and tapes");

Change color of a particular item

This could be useful to show that the category is currently unavailable or a certain item is out of stock.

$("#ddlCategories option[value='videos']").css("color", "#CCC");

Get number of options

Don't forget to subtract options that don't count, e.g. the empty "- Select a category -" option.

alert("Number of options: " + ($("#ddlCategories option").length - 1));

Set a particular option

Set the option 'videos' to be the selected item.

$("#ddlCategories option[value='videos']").attr("selected", "selected");

Checkboxes

Our sample checkbox list:

<div id="chkCategoriesContainer">
	<input type="checkbox" name="chkCategories" value="none" checked="checked" />None<br/>
	<input type="checkbox" name="chkCategories" value="books" />Books<br/>
	<input type="checkbox" name="chkCategories" value="videos" />Videos<br/>
	<input type="checkbox" name="chkCategories" value="dvds" />DVDs<br/>
</div>

Check all items in the checkbox list

This could be invoked e.g. through a link named 'Check all'.

$("input[name='chkCategories']").attr("checked","checked");

Uncheck all items in the checkbox list

Same here, uncheck all, a very common requirement.

$("input[name='chkCategories']").removeAttr("checked");

Make the second item being checked

List is zero-based, so the second item is nth(1) 😉

$("input[name='chkCategories']:nth(1)").attr("checked","checked");

Show the value of each checked item (requires a container!)

In this case we simply alert the value, but we could might as well write it to another output field, container or whatever you may wish.

$('#chkCategoriesContainer :checkbox:checked').each(function() {
	alert($(this).val());
	//$('#outputField').append(', '+$(this).val());
});

Radio

Our sample list again:

<div id="rdoCategoriesContainer">
	<input type="radio" name="rdoCategories" value="none" checked="checked" />None<br/>
	<input type="radio" name="rdoCategories" value="books" />Books<br/>
	<input type="radio" name="rdoCategories" value="videos" />Videos<br/>
	<input type="radio" name="rdoCategories" value="dvds" />DVDs<br/>
</div>

Get value of checked item

alert("Selected value: " + $("input[name='rdoCategories']:checked").val());

Append item to container

The item will be added to the DOM and is available to jQuery immediately.

$('#rdoCategoriesContainer').append('<input type="radio" name="rdoCategories" value="tapes" />Audio tapes<br/>');
22Jan0

Highlights of Week 03/2010

Posted by Michael Gaigg

Suggested reading:
7Oct0

The importance of the JavaScript parseInt radix

Posted by Michael Gaigg

Problem:

Just recently I had to implement an HTML form that allows users to enter percentage values. Like every good programmer I added client-side validation to check that the input values are between 0 and 100.

Using the JavaScript function parseInt(txtValue) with txtValue being the value of the input field our tester was able to submit the form with a value of 0137.

My first reaction was to restrict the maxlength attribute of the input field to 3 characters only. Even though this is a good and recommended practise there was clearly something else wrong.

Explanation:

The parseInt() function parses a string and returns an integer. The signature is parseInt(string, radix) with

  • string (required) being the string to be parsed, and
  • radix (optional) a number (from 2 to 36) that represents the numeral system to be used

If the radix parameter is omitted, JavaScript assumes the following:

  • If the string begins with “0x”, the radix is 16 (hexadecimal)
  • If the string begins with “0”, the radix is 8 (octal)
  • If the string begins with any other value, the radix is 10 (decimal)

Solution:

So, what happened? Because I forgot to specify the radix and our QA tester tried the (however unlikely) case of 0137 JavaScript assumed it was an octal number and returned a value of 95. Lesson learned: Always specify the radix (if it decimal set it to 10 ;)!!!!

PS.: Only the first number in the string is returned!
PPS.: Leading and trailing spaces are allowed.
PPPS.: If the first character cannot be converted to a number, parseInt() returns NaN.