cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic text fied input

former_member602416
Participant
0 Kudos

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..

Accepted Solutions (1)

Accepted Solutions (1)

mantrishekar
Active Participant
0 Kudos

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.

Answers (0)