Input - Value States
This example shows different input value states.
Z2UI5_CL_SMPC_APP_032
Controls
sap.m
UI5 1.94
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_032- Source file
z2ui5_cl_smpc_app_032.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.Input- Demo kit sample
sap.m.sample.InputValueState- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.94
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: input, sap.m, shows, different, value, state, vbox, formattedtext, link
Controls it builds
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smpc_app_032.clas.abap — 134 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords input sap.m shows different value state vbox formattedtext link
" @summary This example shows different input value states.
CLASS z2ui5_cl_smpc_app_032 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_032 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_navigated( ).
view_display( ).
ELSEIF client->check_on_event( ).
on_event( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(warning_text) = `Warning message. Extra long text used as a warning message. Extra long text used as a warning message - 2. ` &&
`Extra long text used as a warning message - 3. Extra long text used as a warning message - 4. ` &&
`Extra long text used as a warning message - 5.`.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->ele( `VBox`
)->a( n = `class` v = `sapUiSmallMargin`
)->tag( `Input`
)->a( n = `value` v = `Value state None`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->tag( `Input`
)->a( n = `showClearIcon` v = `true`
)->a( n = `valueState` v = `Success`
)->a( n = `value` v = `Value state Success`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->tag( `Input`
)->a( n = `showClearIcon` v = `true`
)->a( n = `valueState` v = `Warning`
)->a( n = `valueStateText` v = warning_text
)->a( n = `value` v = `Value state Warning.`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->ele( `Input`
)->a( n = `showClearIcon` v = `true`
)->a( n = `valueState` v = `Warning`
)->a( n = `value` v = `Value state Warning with message containing a link.`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->ele( `formattedValueStateText`
)->ele( `FormattedText`
)->a( n = `htmlText` v = `There is a conflict with the current value. Recommendation based on: %%0`
)->ele( `controls`
)->tag( `Link`
)->a( n = `text` v = `See more information`
)->a( n = `href` v = ``
)->a( n = `press` v = client->_event( `LINK_PRESS` )
)->end(
)->end(
)->end(
)->end(
)->tag( `Input`
)->a( n = `valueState` v = `Error`
)->a( n = `value` v = `Value state Error`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->tag( `Input`
)->a( n = `valueState` v = `Information`
)->a( n = `value` v = `Value state Information`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->ele( `Input`
)->a( n = `valueState` v = `Information`
)->a( n = `value` v = `Value state Information with message containing multiple links.`
)->a( n = `class` v = `sapUiSmallMarginTopBottom`
)->ele( `formattedValueStateText`
)->ele( `FormattedText`
)->a( n = `htmlText` v = `Recommendation based on: %%0 and %%1.`
)->ele( `controls`
)->tag( `Link`
)->a( n = `text` v = `link 1`
)->a( n = `press` v = client->_event( `LINK_PRESS` )
)->tag( `Link`
)->a( n = `text` v = `link 2`
)->a( n = `press` v = client->_event( `LINK_PRESS` )
)->end(
)->end(
)->end(
)->end(
)->end( ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `LINK_PRESS`.
client->message_toast_display(
text = `You have pressed a link in value state message`
my = `center center`
at = `center center` ).
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.m
- Flex Box - Nested — Flex Boxes can be nested. Remember also that HBox and VBox are 'convenience' controls bas…
- Generic Tag with Different Configurations — Previews of the GenericTag control based on combinations of different sets of properties.
- KPI Tile — Shows KPI Tile samples that can contain header, subheader, key value, trend, scale, unit…
- Header Container - Horizontal Mode — The Header Container with horizontal layout. It provides horizontal scrolling on mobile d…
- Icon Tab Bar - Stretch Content Height — In this example, the IconTabBar height is stretched to the maximum height of the page con…
- Image with ImageMode.Background — Visualizes the state of the control when the mode property is set to ImageMode.Background.
- Link - Emphasized — Usually you use an Object Identifier in the first column of a table. But if you need an a…
- List - Counter Indication — The counter of an item quickly shows how many detail entries are related, without having…
- List - No Data Indication — If the list is empty it indicates this state by displaying a message text.
- Message Box Initial Focus — Shows how to set initial focus to MessageBox button.
- Message Toast — The Message Toast displays the message text as an overlay to the current screen. It close…
- Message View connected with Message Model — A sample showing how you can connect the MessageView with MessageManager.
On this page