As in standard smartphones, lists, forms, and other content must be placed inside the content div in order to make use of the styles contained in the generated stylesheets.
Lists
Simple lists of items or links can be displayed on the BlackBerry.
<ul> <li><%= url_for :controller => :Product %></li> <li><%= url_for :controller => :Inventory %></li> <li><%= url_for :controller => :Location %></li> <li><%= url_for :controller => :Purchase %></li> </ul>
Examples can be found in the generated application and model index files.
Tables
Any content that requires precise alignment of containers should be placed in tables.
BlackBerry Browser 4.2 does not support defining table data cell widths through css. If you wish to maintain evenly-spaced columns throughout your form, you must manually define the width of one column in every row. Typically, setting the width of the label-containing cell to 125 (width=“125”) provides sufficient width for a descriptive label without compromising the space available for user input.
Examples of tables with a defined width can be found in generated model new.bb.erb files. Examples of tables with no width defined can be seen in generated model show.bb.erb files.
Forms
Creating a custom “New” Form for BlackBerry
You can create native-styled forms by organizing form fields in one or more tables inside a view’s “content” div.
Include a form tag inside the \
<form method="POST" action="<%= url_for :action => :create %>"> </form>
Add a \<table> tag inside your form. To break your fields into multiple groupings, include one \<table> tag to contain each group as described above.
to append a label to a group of fields, include the label inside a \
tag immediately before the table containing those fields.
Add one \<tr> tag inside the \<table> tag for each input field/field label. You must adhere to the syntax found in the examples below to access the appropriate styles for the BlackBerry.
each checkbox and radio button must be contained inside its own row. Further discussion of the formatting can be found later in this document.
To include a “submit” button, immediately below the last closing \</table> tag and immediately above the closing \</form> tag.
the button should ‘'not’‘ be contained inside an \<tr> tag.
<input type="submit" value="Create" />
Creating a custom “Edit” Form for BlackBerry
You can create native-styled forms by organizing form fields in one or more tables inside a view’s “content” div.
Include a form tag inside the \
<form method="POST" action="<%= url_for :action => : update %>"> </form>
Add a \<table> tag inside your form. To break your fields into multiple groupings, include one \<table> tag to contain each group as described above.
to append a label to a group of fields, include the label inside a \
tag immediately before the table containing those fields.
When creating an edit form, it should include a hidden field that contains the id of the object being edited.
<input type="hidden" name="id" value="<%= @model_name.object %>"/>
Add one \<tr> tag inside the \<table> tag for each input field/field label. You must adhere to the syntax found in the examples below to access the appropriate styles for the BlackBerry.
each checkbox and radio button must be contained inside its own row. Further discussion of the formatting can be found later in this document.
To include a “submit” button, immediately below the last closing
the button should ‘'not’‘ be contained inside an
tag.
<input type="submit" value="Update" />
Form elements
Each form element will take up a full table row. Note: each checkbox and radio button will need to be contained inside its own list item.
BlackBerry Browser 4.2 does not support defining table data cell widths through css. If you wish to maintain evenly-spaced columns throughout your form, you must manually define the width of one column in every row. Typically, setting the width of the label-containing cell to 125 (width=“125”) provides sufficient width for a descriptive label without compromising the space available for user input.
Text fields
<tr> <td width="125">Textbox1: </td> <td><input type="text" name="uiformdemo[textbox1]"/></td> </tr>
Checkboxes/Switches
<tr> <td width="125">Checkbox1: </td> <td><input type="text" name="uiformdemo[checkbox1]"/></td> </tr>
Radio Buttons
<h2 class="groupTitle">Radio Button</h2> <table> <tr> <td width="125">Radiobutton1: </td> <td><input type="text" name="uiformdemo[radiobutton]" value="radiobutton1" /></td> </tr> <tr> <td width="125">Radiobutton2: </td> <td><input type="text" name="uiformdemo[radiobutton]" value="radiobutton2" /></td> </tr> <tr> <td width="125">Radiobutton3: </td> <td><input type="text" name="uiformdemo[radiobutton]" value="radiobutton3" /></td> </tr> </table>
Select boxes
<h2 class="groupTitle">Select Box</h2> <table> <tr> <td width="125">Select device</td> <td> <select name="uiformdemo[selectbox]"> <option selected>Please select</option> <option value="apple">iPhone</option> <option value="android">Android</option> <option value="blackberry">BlackBerry</option> <option value="winmo">Windows Mobile</option> </select> </td> </tr> </table
Text areas
Each textarea tag must include attributes for the number of rows and columns. The recommended values for rows and columns can be found below. Additionally, each textarea tag must have both an opening \<textarea> and closing \</textarea> tag: self-closing textarea tags will not be displayed properly in your application.
<tr> <td width="125">Textarea: </td> <td><textarea name="uiformdemo[textarea]" rows="5" cols="30"></textarea></td> </tr>
Buttons
Buttons involved in form submission should be created as input tags, type submit. Buttons should be placed directly between the last closing \</table> tag and the closing \</form> tag, and should not be contained inside an \<table>,\<tr>, or \<td> tag.
Links used to perform actions related to the form but not involved in form submission (e.g., Delete, Cancel) should be located in the top toolbar instead.
<input type="submit" class="standardButton" value="Create"/>
\<button> elements are not supported on the BlackBerry platforms.