on 10-19-2015 11:49 AM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for your response.
i checked bootstrap and did't find anything difference.
i am pasting my total code
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons"
data-sap-ui-theme="sap_goldreflection">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
sap.ui.localResources("ztest");
var view = sap.ui.view({id:"idfirst1", viewName:"ztest.first", type:sap.ui.core.mvc.ViewType.JS});
view.placeAt("content");
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");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
thanks for your help...:)
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.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
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.