SUP Hack – Adding HTML Markup

Here’s a simple little workaround/hack to add a simple bit of snap to your Hybrid Web Container applications.  The ‘default value’ of any label control, or even the label on a control (like an entry field) can contain HTML markup.

This example shows:
a) A label field surrounded by <h1> presents as ‘header-1’ style text.
b) A label field with ‘default’ value of <hr /> presents as a horizontal rule.
c) The label for an entry field has the individual ‘N’ and ‘S’ set to bold.
d) This is executing on the Android emulator (using jQueryMobile as the framework).

Example showing HTML markup

Caveats:
a) Be careful about the HTML markup being used as an SUP ‘key’ – that is asking for trouble.
b) Make sure your HTML is properly closed.  Just about everything resides in its own ‘DIV’ which is pretty sensitive to unbalanced markup.
c)  We are planning on having a ‘correct’ implementation where everything can be tied to a CSS class, but this is still in the planning/talking stage.

Advertisements