cancel
Showing results for 
Search instead for 
Did you mean: 

Clear form efficiently and fast

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

not really sure that setting it not visible will clear the values that the user inserted into the fields of a form.

santhu_gowdaz
Active Contributor
0 Kudos

how it will clear if you set this variable to visible property

former_member182862
Active Contributor
0 Kudos

I think what need to be done is the reset the value like this

JS Bin - Collaborative JavaScript Debugging

Thanks

-D

Former Member
0 Kudos

How can I apply this to datePickeres, dropdownboxes and checkboxes.

Qualiture
Active Contributor
0 Kudos

For dropdowns should work just fine (in addition, check for data type and set non-string values to 0 or false)

Former Member
0 Kudos

This message was moderated.

Answers (0)