Coding References

Select from below tags to sort coding references by different order


Formatting - Basics

Formatting - Tab

Formatting - Header/Footer

Formatting - Others

Image

Text Style

Clickable Row Link

Button Link

Link behaviours - Basics

Link behaviours - Popup

Link behaviours - Others

Form

Form Inputs

Colorings

Album

Map

Other Widgets

Phone Features

Hardware Features

Multimedia

Caching

Database

DB Layout Template

Supported HTTP features

<wf_titlebar bgcolor="#RRGGBB">
API version: Version 0.9
Supported platform: iPhone, Android, BlackBerry, Debugger
Define a title bar for the page and assign it a background color. You can add buttons to the left and right sides of the titlebar, and give a title that is centered within the titebar. The buttons and title are defined inside the <wf_titlebar> </wf_titlebar> tags.

Notes:
• The background color is specifed as 2-hexidecimal digits for the red, green, and blue values, prefixed with a "#" to indicate the numbers are in hex. E.g., bgcolor="#FF0000" gives a red background.

• The titlebar title is specified by <title> </title> tags within the <wf_titlebar> </wf_titlebar> tags.

• To add buttons to the titlebar use either a link tag, <a>, or a, for a form, an <input type="submit"> tag. The buttons can have icons; these are specified by an <img> tag or by the wf_icon attribute for <input> tags.

You can add <img> tag in <title> also.
 1.
<html> 
<head><title>Title Bar</title></head> 
<body> 
    <wf_titlebar> 
        <a align="left" href="009-div.html">OO</a> 
 
        <title align="center">Hello Bar</title> 
 
        <a align="right" href="009-div.html"><img src="toolbar_add.png"/></a> 
    </wf_titlebar> 
</body> 
</html>

2.
<html> 
<head><title>Title Bar</title></head> 
<body> 
    <wf_titlebar bgcolor="#330000"> 
        <a align="left" href="009-div.html">OO</a> 
        <input align="left" type="submit" form="form" value="DD"/> 
        <input align="left" type="submit" form="form2" value="EE" wf_icon="toolbar_add.png"/> 
 
        <title align="center">Title Bar 2</title> 
 
        <a align="right" href="009-div.html">AA</a> 
        <a align="right" href="009-div.html">BB</a> 
        <a align="right" href="009-div.html"><img src="toolbar_add.png"/></a> 
    </wf_titlebar> 
 
    <form id="form" action=""> 
    <div>Hello World</div> 
    <div><input type="hidden" name="hello" value="world DD"/></div> 
    </form> 
 
    <form id="form2" action=""> 
    <div><input type="hidden" name="hello" value="world EE"/></div> 
    </form> 
 
    <div> 
        <input type="hidden" name="outside" form="form" value="form"/> 
        <input type="hidden" name="outside" form="form2" value="form2"/> 
    </div> 
 
    <div>Hello: </div> 
    <div>Form: </div> 
</body> 
</html> 

3.
<html> 
<head><title>Title Bar</title></head> 
<body> 
    <wf_titlebar bgcolor="#330000"> 
        <a align="left" href="009-div.html">OO</a> 
        <input align="left" type="submit" form="form" value="DD"/> 
        <input align="left" type="submit" form="form2" value="EE" wf_icon="toolbar_add.png"/> 
 
        <title align="center"><img src="title_image.png"/></title> 
 
        <a align="right" href="009-div.html">AA</a> 
        <a align="right" href="009-div.html">BB</a> 
        <a align="right" href="009-div.html"><img src="toolbar_add.png"/></a> 
    </wf_titlebar> 
 ...
</body> 
</html> 
iPhone
Android
BlackBerry

<wf_tabbar>
API version: Version 1.0
Supported platform: iPhone, Android, BlackBerry, Debugger
Create a tabbar. A tabbar is a list of links to other pages of the app. This list acts like a tabbar on a browser, with all the tab links visible, and the contents of one tab active at a time. The tabbar appears at the bottom of the screen on an iPhone or BlackBerry and at the top of the screen on an Andriod phone.

By default, the contents of the first tab is loaded when the page loads. This default can be overridden by using the attribute 'wf_style="selected"' in the <a> link definition for the tab you wish to load initially.

A MotherApp tabbar is similar to a <frameset>, except that the contents of the tabs do not all appear on the screen together. The master page containing the tabbar definition
(<wf_tabbar></wf_tabbar>) should include the links to the various tabs. These tabs must be in separate files and not in the master page that contains the tabbar definition.

A tabbar must be at the top level of the app definition within <body></body> tags. It canot be embedded, for example, within a table.

http://tedtalk.willflow.com/ is an example of a tabbar based app. This example contains a tabbar widget and links to three pages.

Defining Tabs:
• Each tab is defined as an <a> link.
• Within each <a> link use the attributes "wf_tab_img" and "wf_tab_img_active" to specify
the graphic images to display for the tab.
For iPhone apps, you only need to specify "wf_tab_img", since the iPhone generates a blue
shading and shadow for the active tab automatically. The tab images should be:
- 40 by 30 pixels.
- In PNG format files with 24-bit color and a transparent background.
- Do not add a shadow effect to the tab image.
- The text label for the icon should be included in the link not in the image.

 <html>
  <head><title>Tab Demonstration</title></head>
  <body>
    <wf_tabbar>
      <a href="052-tab_1.html" wf_tab_img="tab_icon.png" 
        wf_tab_img_active="tab_icon_on.png">Tab 1</a>
      <a href="052-tab_2.html" wf_tab_img="tab_icon.png" 
        wf_tab_img_active="tab_icon_on.png">Tab 2</a>
    </wf_tabbar>
  </body>
</html>

  --- 052-tab_1.html (this is in a separate file) ---
  --- since this is the first tab, it's contents are initially loaded into the app ---
<html>
  <head><title>1st Tab</title></head>
  <body>
    <table wf_style="fullscreen">
      <tr> <td wf_style="padding">
        <a href="tab_child.html">Go to child page</a>
      </td> </tr>
      <tr> <td wf_style="padding">
        <a href="tab_child.html">Go to child page</a>
      </td> </tr>
      <tr> <td wf_style="padding">
        <a href="tab_child.html">Go to child page</a>
      </td> </tr>      <tr> <td wf_style="padding">
        <a href="tab_child.html">Go to child page</a>
      </td> </tr>
      <tr> <td wf_style="padding">
        <a href="tab_child.html">Go to child page</a>
      </td> </tr>      <tr> <td wf_style="padding">
        <a href="tab_child.html">Go to child page</a>
      </td> </tr>
    </table>
  </body>
</html>
iPhone
Android
BlackBerry

<img src="xxx.jpg" width="nn" height="nn">
API version: Version 0.9
Supported platform: iPhone, Android, BlackBerry, Debugger
Specify the location and size of an image to display. The image will be located on the screen based on where the <IMG> tag is located in your code. The src attribute gives the location of the graphic image to display. This location can be given as an absolute or relative path.

If no width or no height attributes, the image will be retrieved from the server before rendering the UI. This may introduce performance impacts rendering UI elements. If you include the image width and height attributes, MotherApp will first render the non-graphical portions of the UI and then the image will be loaded.

If the image is the only child in a table element (<td>), MotherApp will automatically fit the width of <td> to the width of the image.
 1.
<html>
	<head><title>img test case</title></head>
	<body>
		<div>JPG: <img src="hello_world.jpg" width="48" height="48"/></div>
		<div>PNG: <img src="hello_world.png" width="45" height="41"/></div>
		<div>GIF: <img src="hello_world.gif" width="50" height="50"/></div>
		<div>No this image: <img src="no_this_image.jpg" width="50" height="50"/></div>

	</body>
</html>

2.
<html>
	<head><title>img test case</title></head>
	<body>
		<table>
		
                <tr>
                    <td wf_style="padding">
                        <img src="hello_world.jpg" width="48" height="48"/>
                    </td>
                    <td wf_style="padding">

                        World
                    </td>
                </tr>
                <tr>
                    <td wf_style="padding">
                        <img src="hello_world.jpg" width="48" height="48"/>
                    </td>
                    <td wf_style="padding">

                        World
                    </td>
                </tr>
                <tr>
                    <td wf_style="padding">
                        <img src="hello_world.jpg" width="48" height="48"/>
                    </td>
                    <td wf_style="padding">
                        Man
                    </td>

                </tr>
			
		</table>
	</body>
</html>
iPhone
Android
BlackBerry

<a wf_style="navigation_pushed">
API version: Version 0.9
Supported platform: iPhone, Android, BlackBerry, Debugger
When user navigates from one page to the other, MotherApp stores your navigation history in the "Navigation Stack". This allows user to navigate back to visited page(s) through the "Back" button. It should be noted that each tab defined in the Tabbar has its own Navigation Stack.

If an <a> link has wf_style="navigation_pushed" defined, MotherApp will replace the current page with the target page of the link and puts the formerly current page on the top of the navigation stack, so that pressing the "Back" button returns to the original page.

On an iPhone, MotherApp automatically adds a "Back" button to the titlebar when appropriate (when there is a previous screen); on other mobile platforms there is a "Back" hardware button for some mobile devices. This "Back" button would have the same behaviour as the "Back" button in iPhone.
 page A:
<html>
    <head><title>Level 1</title></head>
    <body>
        <table>
            
                <tr>
                    <td wf_style="padding">
                        <a href="031-navigation_testing_level_2.html?dummy=value1&dummy2=value2">
                            Goto Level 2
                        </a>

                    </td>
                </tr>
                <tr>
                    <td wf_style="padding">
                        <a href="broken_link.html">
                            Broken Link
                        </a>
                    </td>
                </tr>

            
        </table>
    </body>
</html>

page B:
<html>
    <head><title>Level 2</title></head>
    <body>
    	<div>You should have a back button automatically</div>
        <table>
            
                <tr>
                    <td wf_style="padding">

                        <a href="031-navigation_testing_level_3.html">
                            Goto Level 3
                        </a>
                    </td>
                </tr>
            
        </table>
    </body>
</html>
iPhone
Android
BlackBerry

<form method="get/post" action="url" [enctype="multipart/form-data" wf_style="navigation_pushed/navigation_reset/navigation_unchanged"]>
API version: Version 0.9
Supported platform: iPhone, Android, BlackBerry, Debugger
Use the <form> tag to submit information from the mobile device to web server. Both get and post methods are supported.

• The "get" method will submit the user's input as part of the URL string going to your web server. This information is unencrypted and so should not be used for sensitive data. There is also a limit set by your web server on how much data you can put in a URL.

• The "post" method sends the form data in the body of the request as an HTTP post transaction. This is more robust and secure than "get", and does not have size limitations.

action="url": The "url" is the address to which the form data will be sent.

enctype="multipart/form": If you want to send non-text data such as images, use this attribute.

wf_style="navigation_pushed/navigation_reset/navigation_unchanged" (Optional)
As with <a> tags, these values for wf_style allow you to control the navigation stack:

• Navigation_unchanged: This does not add the current page to the navigation stack but still navigates to the new page. If the user then presses the "Back" button they will go back to the last page on the current navigation stack, skipping over the previous page. It is strongly recommended to use navigation_unchanged for <form> submission to avoid unexpected resubmissions.

•Navigation_pushed: Puts the current page on the top of the current navigation stack and goes to the new page.

•Navigation_reset: Removes all the contents from the current navigation history stack.
 <html>
    <head><title>Textbox</title></head>
    <body>
        <form action="036-form_get_textbox.php" method="get">
            <div>
            <div><input type="text" name="query"/></div>
            <div><input type="submit" name="s" value="Submit"/></div></div>
        </form>
    </body>
</html>
iPhone
Android
BlackBerry

<div|body|table|tr|td|a|span| wf_style="text_color:#RRGGBB">
API version: Version 0.9
Supported platform: iPhone, Android, BlackBerry, Debugger
The attribute wf_style="text_color:#RRGGBB" is used to specify the color the text within a UI element. It can be used within any of the following tags:
<body>, <table>, <tr>, <td>, <a>, <div>, or <span>. All sub-elements of the tag will inherit the given text color, unless a different color is specified.

The color is given in hexidecimal (indicated by the "#" prefix), with two hex digits each for the red, green, and blue values. Thus red = "#FF0000", blue = "#0000FF", black = "#000000", and white = "#FFFFFF", etc.
 <html> 
	<head><title>Text color</title></head> 
	<body wf_style="text_color:#AAAAAA"> 
        <table wf_style="fullscreen"><tr><td> 
        <div>Gray Text</div> 
 
        <div>Gray Text
            <div wf_style="text_color:#AA0000">Red Text</div> 
            <div wf_style="text_color:#00AA00">Green Text</div> 
            <div wf_style="text_color:#0000AA">Blue Text</div> 
        </div> 
 
        <div wf_style="text_color:#AA0000">Red Text
            <div>Red Text</div> 
            <div wf_style="text_color:#00AA00">Green Text</div> 
            <div wf_style="text_color:#0000AA">Blue Text</div> 
        </div> 
        </td></tr></table> 
 
		<table wf_style="fullscreen"> 
            <tr><td>Gray Text</td></tr> 
			<tr wf_style="text_color:#00AA00"> 
                <td>Green Text</td> 
            </tr> 
			<tr> 
                <td wf_style="text_color:#0000AA">Blue Text</td> 
            </tr> 
		</table> 
 
		<table wf_style="fullscreen text_color:#AA0000"> 
            <tr><td>Red Text</td></tr> 
			<tr wf_style="text_color:#00AA00"> 
                <td>Green Text</td> 
            </tr> 
			<tr> 
                <td wf_style="text_color:#0000AA">Blue Text</td> 
            </tr> 
		</table> 
 
		<table wf_style="fullscreen text_color:#AA0000"> 
            <tr><td>Red Text
                <div>Red Text
                    <div wf_style="text_color:#AA0000">Red Text</div> 
                    <div wf_style="text_color:#00AA00">Green Text</div> 
                    <div wf_style="text_color:#0000AA">Blue Text</div> 
                </div> 
            </td></tr> 
			<tr wf_style="text_color:#00AA00"> 
                <td>Green Text
                <div>Green Text
                    <div wf_style="text_color:#AA0000">Red Text</div> 
                    <div wf_style="text_color:#00AA00">Green Text</div> 
                    <div wf_style="text_color:#0000AA">Blue Text</div> 
                </div> 
                </td> 
            </tr> 
			<tr> 
                <td wf_style="text_color:#0000AA">Blue Text
                <div>Blue Text
                    <div wf_style="text_color:#AA0000">Red Text</div> 
                    <div wf_style="text_color:#00AA00">Green Text</div> 
                    <div wf_style="text_color:#0000AA">Blue Text</div> 
                </div> 
                </td> 
            </tr> 
		</table> 
	</body> 
</html> 
iPhone
Android
BlackBerry

"wf://device/db/query?subkey[mm]:[nn]=[op]xxx[(-|,)[op]yyy...]&subkey[mm]:[nn]=[op]xxx[(-|,)[op]yyy...][&result_filter=is_empty]"
API version: Version 1.1
Supported platform: iPhone, Android, BlackBerry
Query the local database. It should be used with the [DB UI Template] in order to render the retrieved records into user interface.

Syntax:
subkey[mm]:[nn]:
try to match the substring of the key from index [mm] to index [nn] where [mm] is inclusive and [mm] is exclusive.

[op]: the comparator to compare the key:
"eq": =
"ge": >=
"gt": >
"le": <=
"lt": <
"li": like

Logical operator:
"-": and (using in the same subkey)
",": or (using in the same subkey)
"&": and (using in different subkey)

result_filter=is_empty: if there is no record found, it would return one dummy record. Otherwise, no record return.
 EXAMPLES:
Return records with the key started with "15":
wf://device/db/query?subkey0:2=eq15

Return records with the key started with "15" or "19" or "20":
wf://device/db/query?subkey0:2=eq15,eq19,eq20

Return records for substring(key, 0, 2) >= '15' and substring(key, 2, 4) = 'sun':
wf://device/db/query?subkey0:2=ge15&subkey2:4=eqsun

Return records with the first two characters between "15" and "20":
wf://device/db/query?subkey0:2=ge15-le20

Return 1 record if no result found for wf://device/db/query?subkey0:2=ge15-le20. Otherwise, return 0 record.
wf://device/db/query?subkey0:2=ge15-le20&result_filter=is_empty

see tutorial http://developer.motherapp.com/tutorial/4/#add_delete_query

<tag wf_source="wf://device/db/query?...">
API version: Version 1.1
Supported platform: iPhone, Android, BlackBerry
 <html>
<!--
local db (key, value):
world     |This is offline db sample   |
world1    |This is offline db sample1 |
world2    |This is offline db sample2 |
-->
  <head><title>Table Row Source</title></head>
  <body>
    <table>
      <tr wf_source="wf://device/db/query?subkey0:1=eqw">
        <td width="30%">{{value}}--abc</td>
        <td width="30%">{{value0:3}}--abc</td>
        <td width="10%">{{counter}}</td>
        <td><div>{{key}}</div></td>
      </tr>
    </table>

    <div>
      <input type="text" wf_source="wf://device/db/query?subkey0:1=eqw" value="{{key}}"/>
    </div>
  </body>
</html>

<!--
Result:
<html>
  <head><title>Table Row Source</title></head>
  <body>
    <table>
      <tr wf_source="wf://device/db/query?subkey0:1=eqw">
        <td width="30%">world|This is offline db sample--abc</td>
        <td width="30%">Thi--abc</td>
        <td width="10%">0</td>
        <td><div>world</div></td>
      </tr>
      <tr wf_source="wf://device/db/query?subkey0:1=eqw">
        <td width="30%">world|This is offline db sample1--abc</td>
        <td width="30%">Thi--abc</td>
        <td width="10%">1</td>
        <td><div> world1</div></td>
      </tr>
      <tr wf_source="wf://device/db/query?subkey0:1=eqw">
        <td width="30%">world|This is offline db sample2--abc</td>
        <td width="30%">Thi--abc</td>
        <td width="10%">2</td>
        <td><div> world2</div></td>
      </tr>
    </table>

    <div>
      <input type="text"  wf_source="wf://device/db/query?subkey0:1=eqw" value="world"/>
      <input type="text" wf_source="wf://device/db/query?subkey0:1=eqw" value="world1"/>
      <input type="text" wf_source="wf://device/db/query?subkey0:1=eqw" value="world2"/>
    </div>
  </body>
</html>
-->