on 08-15-2017 1:24 PM
Hi,
In my UI5 development, I am trying to create a simple form with a button. When I am adding the event 'press' in the sap.ui.commons.Button class, I am getting the error:
Uncaught TypeError: Cannot read property '0' of undefined
at d.h.applySettings (ManagedObject-dbg.js:965)
at ManagedObject-dbg.js:436
at d.constructor (ManagedObject-dbg.js:450)
at d.constructor (Element-dbg.js:99)
at d.constructor (Control-dbg.js:103)
at new f (Metadata-dbg.js:346)
at new o (Global-dbg.js:294)
at f.createContent (LoonyToons.view.js?eval:84)
at eval (eval at evalModuleStr (jquery.sap.global-dbg.js:3265), <anonymous>:880:236)
at Function.h.runWithPreprocessors (ManagedObject-dbg.js:800)
Here is my code -
var oForm = new sap.ui.commons.form.SimpleForm('idForm', {
maxContainerCols : 2,
content: [
new sap.ui.commons.Label({text : "Employee Name"}),
new sap.ui.commons.TextField(
{
width :"5cm",
value : "{/empStr/empName}",
enabled : "{/empStr/fieldEnabled}"
}
),
new sap.ui.commons.Label({text :"Employee No."}),
new sap.ui.commons.TextField(
{
width : "4cm",
value : {
path :"/empStr/empNo"
},
enabled :{
path : "/empStr/fieldEnabled"
},
}
),
new sap.ui.commons.Label({text :"Employee City"}),
new sap.ui.commons.TextField({
width : "4cm"
}).bindValue("/empStr/empCity").bindProperty("enabled", "/empStr/fieldEnabled"),
new sap.ui.commons.Button("idButton", {
text : "Press Me",
press : oController.pressMe
})
]
});
return oForm;
As Srikanth already suggest you should:
1) use sap.m.Button
2) use XML View and not JS View
do you have a working demo we could see and test?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
where is the event handler code for the button..? Why are you using sap.ui.commons.Button, this is depricated and you should use sap.m.Button
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.