Skip to Content
avatar image
Former Member

Form is not displayed on page....

hi

i am trying to display simple form on web page but getting error "Message: "undefined" is not valid for aggregation "content" of Element sap.ui.layout.form.SimpleForm#__form0" i was unable to find error in my code.

var oForm = new sap.ui.layout.form.SimpleForm(

  "sf2",

  {

  maxContainerCols: 2,

  editable: true,

  content: [

         new sap.ui.commons.Label("lb1",{text:"name"}),

         new sap.ui.commons.Label("lb2",{text:"Name"}),

         new sap.ui.commons.TextField("tx1",{value:"Max"}),

         ]

  });

  oForm.placeAt("content2");

thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 19, 2015 at 11:10 AM

    I have copy - pasted your code into JSBIN and it works: http://jsbin.com/hezuholivu/1/edit?html,output

    Maybe your bootstrap is missing some library?

    Check the parameter of your .html file, it should look like this:

    data-sap-ui-libs="sap.ui.commons"

    Also, take a look at other parameters.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

    • Try to copy-pase the SAPUI5 code from the JSBIN into your <script> tag instead of your code and see if it works.

      I don't understand why do you place an empty view into "content" tag (why did you define it in the first place?).

      Then, you place your form into "content2" tag which does not exist in your html part.

      As you can see from the JSBIN example, the "clean" code of the form declaration works fine.