Skip to Content

How to enable the save button only when all the fields are filled in SAPUI5.

Hi Experts.

I have requirement to enable the save button when all fields are filled.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Aug 30, 2018 at 12:20 PM

    here you should use the view model,

    // View Model 
    var oViewModel = new JSONModel({}); 
    this.getView().setModel(oViewModel, "viewModel"); 
    this.getView().getModel("viewModel").setProperty("/bEdit", false);

    when all the fields are complete

    this.getView().getModel("viewModel").setProperty("/bEdit", true);

    Then in the XML you can bind the edit property of the button to the bEdit parameter of the model

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 30, 2018 at 02:04 PM

    The first part, where you define the model, this should be in the init

    when a field is updated you will need to call some function to check them all and then update the model accordingly

    Add comment
    10|10000 characters needed characters exceeded