Samples / Controls / sap.m

Input - Password

To make sure the password is not shown as clear text you set the 'type' of an input control to 'Password'.

Class
z2ui5_cl_smpc_app_368
Repository
abap2UI5/samples-controls
Ports
sap.m.sample.InputPassword
UI5 libraries
sap.m, sap.ui.core, sap.ui.layout
Lowest UI5 release
1.71
In the browser
Runs in the playground
Controls it builds
sap.m.Input, sap.m.Label, sap.ui.core.mvc.View, sap.ui.layout.VerticalLayout

The class

" @keywords input sap.m inputpassword verticallayout label
" @summary To make sure the password is not shown as clear text you set the 'type' of an input control to 'Password'.
" @origin sap.m.sample.InputPassword - https://sdk.openui5.org/entity/sap.m.Input/sample/sap.m.sample.InputPassword (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_368 DEFINITION PUBLIC.

  PUBLIC SECTION.
    INTERFACES z2ui5_if_app.

  PROTECTED SECTION.
    DATA client TYPE REF TO z2ui5_if_client.

    METHODS view_display.

  PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_smpc_app_368 IMPLEMENTATION.

  METHOD z2ui5_if_app~main.

    me->client = client.
    IF client->check_on_navigated( ).
      view_display( ).
    ENDIF.

  ENDMETHOD.


  METHOD view_display.

    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`
        )->a( n = `xmlns:l`   v = `sap.ui.layout`

        )->ele( n = `VerticalLayout` ns = `l`
            )->a( n = `class` v = `sapUiContentPadding`
            )->a( n = `width` v = `100%`

            )->tag( `Label`
                )->a( n = `text`     v = `Password`
                )->a( n = `labelFor` v = `passwordInput`
            )->tag( `Input`
                )->a( n = `id`          v = `passwordInput`
                )->a( n = `type`        v = `Password`
                )->a( n = `placeholder` v = `Enter password` ).

    client->view_display( view->stringify( ) ).

  ENDMETHOD.

ENDCLASS.