on 11-16-2017 12:15 PM
Hi,
I have a view which display a input field to fill voucher code and there is a button to click if user wants to enter more vouchers, on click of that button another input field appeared. I have done this in view like below -
var oVoucherLabel = new sap.m.Label({ text : "Voucher Code:" })
var oVoucherCodeInput = new sap.m.Input(this .createId("WorkArea-HD1-VoucherCode"), { type : "Text", })
var addMoreVoucherBtn = new sap.m.Button({ id : "WorkArea-HD1-AddVoucher", text : "Add Voucher",
press : function(){
oVerticalLayout1.addContent
(new sap.m.Input({type : "Text"}))}
var getApplyDiscountBtn = new sap.m.Button({ id : "WorkArea-HD1-UpdatePrice", text : "Apply discount" })
getApplyDiscountBtn.attachPress(oController.OnPressApplyDiscount, oController);
Here I have added input field on press of the function of addMoreVoucherBtn to display a input field on each click of button.
Now I am struggling to get the value of the input field added on the press event in controller file as it can have multiple values depending on the number of times button has pressed. Please suggest..
Hi Swathi,
First add the First Label and respective input field in Vertical Layout.
After that the add the add more voucher input field to the same vertical Layout.
Now to fetch the input values first get all the contents available in Vertical layout .then after you can get the Input fields available in the Vertical Layout by looping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.