cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to dynamically bind and send data from one function to another in a controller

Former Member
0 Likes
1,611

Hi,

Below is my code. I want to capture the input filed value from my Dialog control and pass it to another function (that.submitPrograms). I know this can be done by creating a new fragment file and then get the value of the Input field using this.getView().byId(<ID>), but want to create the dialog and controls in the dialog dynamically in the controller (runtime). If this is not possible to capture Input filed value and pass it to another function with in the controller, please let me know..I will create a fragment file then. Thanks

var oDialog = new sap.m.Dialog({content:[new sap.m.Input({maxLength:1000})], 
                                title: "Please Enter Comments",
				verticalScrolling:true,
beginButton: new sap.m.Button({text:"Submit", press: function(){that.submitPrograms();}}), 
endButton: new sap.m.Button({text: "Cancel", press: function(){this.getParent().close();}})
});
oDialog.open();
View Entire Topic
junwu
SAP Champion
SAP Champion

don't pass data here and there....

put them in model, and always go through binding...

Former Member
0 Likes

Ok. So that is what I am trying to understand.

How can I get the value of the input field (which is in the dialog box) ? I cannot assign an ID to this input filed, as every time I run it creates a duplicate ID and throws error. So basically two questions in the above scenario..

How to get the entered value of the input field (which is in the dialog box) and then how can I bind it or send it to another function ( which in this case is submitPrograms() )

junwu
SAP Champion
SAP Champion
0 Likes

1.never go to ui element to get value.....

2. don't know how to bind ui to model? go through ui5 basic training.....