MAS 9.2 series framework 3.2.8xx
The UI Components guide places the input among the elements that carry every app; this one is about the form. The patterns come from the apps IBM ships in the 9.2 series. Every MAML fence is ours, and every one runs in our Components Explorer app, a small Maximo Mobile app we built for these articles.
Why the smart-input#
A <smart-input> reads the datasource schema behind its value and renders the right control for that attribute. A string gets a text box, a quantity a number box and a date a date picker. A yes-or-no domain gets a toggle, and a field with a domain behind it can get a lookup button. You write one element and the schema does the rest. Change the attribute’s type on the server and the control changes with it.
The plain inputs, <text-input>, <number-input>, <date-input> and their siblings, render what their name says and know nothing about a schema. The element reference says the same sentence on every one of them: when you have a datasource, consider the smart-input instead. So the plain inputs are for values that live in page state, such as a search term, a filter bound, or a note the page keeps for itself.
The decision, and the two elements it leads to.
The field, for showing#
Before any input comes the <field>, which is what a detail page is mostly made of. It shows a caption and a bound value and it edits nothing. label is the caption, value is the binding, and hide-label or label-placement change how the two sit. A <sub-field> under it shows a second value in the same cell, typed with type, which is how a date and a time share one field.
Reach for a field when the user reads, and for a smart-input when the user types. A detail page in the shipped apps is a column of fields with a few smart-inputs among them, and an edit page is the reverse.
A form, in one fence#
<adaptive-row id="fs_f_form_row">
<adaptive-column id="fs_f_form_left" small-width="100" medium-width="50"
large-width="50">
<box id="fs_f_form_left_c" direction="column" fill-parent-horizontal="true">
<field id="fs_f_form_wonum" label="Work order"
value="{fs_f_form_ds.item.wonum}"/>
<smart-input id="fs_f_form_desc" label="Description"
value="{fs_f_form_ds.item.description}" required="true"/>
<smart-input id="fs_f_form_prio" label="Priority"
value="{fs_f_form_ds.item.wopriority}"/>
</box>
</adaptive-column>
<adaptive-column id="fs_f_form_right" small-width="100" medium-width="50"
large-width="50">
<box id="fs_f_form_right_c" direction="column" fill-parent-horizontal="true">
<smart-input id="fs_f_form_loc_si" label="Location"
value="{fs_f_form_ds.item.location}"
enable-lookup-buttongroup="true" lookup="fs_f_form_dlg"
select-lookup-attribute="location"/>
<smart-input id="fs_f_form_start" label="Target start"
value="{fs_f_form_ds.item.targstartdate}"/>
<smart-input id="fs_f_form_done" label="Work complete"
value="{fs_f_form_ds.item.workcomplete}"/>
</box>
</adaptive-column>
</adaptive-row>Read that fence for what it does without being told. The work order number is a field, because nobody edits it. The description is required, and the datasource already knew that, so required here only makes it visible. Priority renders as a number box because the schema says it is a number. The target start renders a date picker. The work-complete flag renders a toggle, because its domain is yes-or-no. Nothing in the markup names any of those controls.
Each column holds a box. An adaptive column lays its children side by side. We built the form first without the box, and on a tablet the work order, the description and the priority stood in one row, with the location box cut down to five letters. A <box direction="column"> inside each column stacks them. IBM’s apps do the same: the first element inside an adaptive column is most often a box or a single field.
Two adaptive columns at half width on a tablet become one column each on a phone, and the markup does not change.


Choices: toggle, dropdown, radio#
Three elements exist for a value that is one of a few:
<toggle>is for two states and takestoggled,toggle-label-onandtoggle-label-off.<dropdown>holds<dropdown-item>children withtextandvalue, or binds a datasource throughdatasource-value-fieldanddatasource-text-field, and it is the one that reaches Maximo.<radio-buttons>holds<radio-button>children and shows every choice at once. It exists in the MAF web apps only. Maximo Mobile does not support it, so on a device a short list of choices is a dropdown.<checkbox>takescheckedand is a single yes-or-no next to its label.

<toggle id="fs_f_choices_one_toggle" label="Run the pump" toggled="true"
on-toggle="toast" type="YesNo"/>
<checkbox id="fs_f_choices_one_check" label="Work complete" checked="false"
on-change="toast"/>
<dropdown id="fs_f_choices_one_drop" label="Location"
unselected-placeholder="Pick a location" on-change="toast">
<dropdown-item id="fs_f_choices_one_i0" value="HALL-A" text="HALL-A"/>
<dropdown-item id="fs_f_choices_one_i1" value="HALL-B" text="HALL-B"/>
<dropdown-item id="fs_f_choices_one_i2" value="YARD" text="YARD"/>
</dropdown>A dropdown without a value reads “Unspecified”. unselected-placeholder puts your own words there.
The rule the shipped apps follow: a yes-or-no attribute on a datasource is a smart-input, which renders the toggle itself. The three choice elements are for values the page owns.
How a lookup attaches#
The location field in the fence above has a button beside it. enable-lookup-buttongroup shows the button, and select-lookup-attribute names which attribute of the picked row goes into the box. The button opens a lookup in one of two ways:
lookup="<id>"names the lookup dialog directly. The pick then writes the value into the box by itself.on-smart-lookup-clicknames a controller method that opens the dialog. Then your code writes the value. In our test the box kept its old value until the handler set it.
The shipped apps usually gate the button on the field having a domain, so a free-text field never grows a button.
The sequence below uses the first way. A tap on the search button beside Location opens the lookup. “hall” narrows six locations to two. A tap on HALL-B closes the lookup, and the box reads HALL-B.

<smart-input id="fs_f_lookup_attach_shorthand_si" label="Location"
value="{fs_f_lookup_ds.item.location}"
enable-lookup-buttongroup="true" select-lookup-attribute="location"
lookup="fs_f_lookup_dlg"/>
<lookup id="fs_f_lookup_dlg" datasource="fs_f_lookup_loc"
lookup-heading="Pick a location" show-search="true" show-count="true"
lookup-attributes="{['location', 'description']}"/>What happens after the pick, which is the mapping that copies the chosen row’s values back into your record, lives on the datasource schema and has its own name. That mapping, the full input-kind table, autocomplete, the change and blur hooks, and what one field validates, are in the smart-input post for members.
What to read next#
Dialogs and Lookups explains the lookup dialog itself, and Layout with Containers the boxes a form is built from. Lists and Data-Lists is the list a form usually opens from, and UI Components is the overview of every family.
The element reference IBM ships is available on your own MAS install. In the Application Configuration application, open the ? menu and choose Component Documentation. The smart-input, field, toggle and dropdown entries list every attribute named above.
