Skip to Content
avatar image
Former Member

Clear form efficiently and fast

Hi,

I have a UI5 (javascript) application where i have an icontabbar which has multiple icontabfilters. Each IconTabFilter has a sap.ui.layout.form.Form for content.

Each IconTabFilter is basically a view and has a back button. What is the best way to clear all the forms of all the icontabfilters? Basically i need to set the whole icontabbar to the way it was when first opened/loaded.

Going through all the fields of a form clearing the values and setting their valuestates, changing all the icons etc is tedious and doesn't feel reasonable to me.

Is there a better, cleaner more efficient way of doing this?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jul 24, 2015 at 11:40 AM

    create 1 json model and bind that model to your corresponding view and form elements like below,

    commonModel = {

        form1Visible: false,

        form1ValueState: false,

    };

    var oModel = new sap.ui.model.json.JSONModel(this.commonModel);

    this.getView().setModel(oModel, "CommonModel");

    In view,

    visible="{CommonModel>/form1Visible}"

    so if you want those as visible then,set that corresponding property value as true or false based on your requirement.

    Add comment
    10|10000 characters needed characters exceeded