/scripts/ahub.form.attachments.js
-1

Adding Form Container and Form Elements Dynamically in UI5

Apr 05, 2017 at 08:54 AM

501

avatar image

Hi All,

Am trying to create a form using below lines of code.

var proposalLayout = new sap.ui.layout.form.GridLayout("L2"); var proposalForm = new sap.ui.layout.form.Form("proposalForm",{ editable: true, layout: proposalLayout, formContainers: [ new sap.ui.layout.form.FormContainer({ //title: "Proposed Solution", formElements: [ new sap.ui.layout.form.FormElement({ label: "Solution Name", fields: [new sap.m.Input("solNameInput",{layoutData: new sap.ui.layout.form.GridElementData({hCells: "13"})})] }), new sap.ui.layout.form.FormElement({ label: "Prepared by", fields: [new sap.m.Input("preparedByInput",{ layoutData: new sap.ui.layout.form.GridElementData({hCells: "13"})})] }) ] }), new sap.ui.layout.form.FormContainer({ title: "Case Benefits", formElements: [ new sap.ui.layout.form.FormElement({ label: new sap.m.Label({text: "Cost"}), fields: [new sap.m.Input("costInput",{layoutData: new sap.ui.layout.form.GridElementData({hCells: "1"})})] }) ], layoutData: new sap.ui.layout.form.GridContainerData({halfGrid: true}) }), new sap.ui.layout.form.FormContainer({ formElements: [ new sap.ui.layout.form.FormElement({ label: new sap.m.Label({text: "Benefits"}), fields: [new sap.m.Input("benefitsInput",{layoutData: new sap.ui.layout.form.GridElementData({hCells: "1"})})] }) ], layoutData: new sap.ui.layout.form.GridContainerData({halfGrid: true}) }), ] });

Now again i need to regenerate the same form when i click on a Button.

Could any body please help me to acheive this functionality

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Jun Wu Apr 05, 2017 at 11:59 AM
0

what's your problem?

Share
10 |10000 characters needed characters left characters exceeded
Mantri Shekar Apr 06, 2017 at 05:35 AM
0

Hi Junwu,

When i click on PLUS Button again i need to get the below form need to be added on this page.

Regards,

Shekar.


Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 23, 2017 at 08:41 AM
0

did you found the solution..??? Let me Know

Share
10 |10000 characters needed characters left characters exceeded
Yen Shen, Ben Lim Mar 06 at 10:07 AM
0

I'm having this requirement as well. Any solution for this?

Share
10 |10000 characters needed characters left characters exceeded
Skip to Content