The property readOnly is undefined ... type RuntimeComponent

Questions and answers for designing and implementing forms in Servoy

The property readOnly is undefined ... type RuntimeComponent

Postby Mark Crichton » Fri Sep 14, 2012 9:42 am

Hi Folks

I have a following warning and am not sure if I can ignore it, or why or how to fix it.
The property readOnly is undefined for the type RuntimeComponent
Appears on line "elements[allNames[i]].readOnly = false" only
Taken from Solution Sample originally.


Example
var allNames = elements.allnames

for ( var i = 0 ; i < allNames.length ; i++ )
{
//work on fields only - starting with name "fld_"
if(allNames[i].indexOf('fld_') >= 0){
//if it's a field - then change color and make editable
elements[allNames[i]].bgcolor = '#feffe4'
elements[allNames[i]].enabled = true
elements[allNames[i]].readOnly = false
}

Thanks Mark
Mark Crichton
DataWise Ltd - New Zealand
http://www.datawise.co.nz
User avatar
Mark Crichton
 
Posts: 109
Joined: Mon Jan 24, 2011 10:01 am
Location: Auckland, New Zealand

Re: The property readOnly is undefined ... type RuntimeCompo

Postby Thomas Parry » Fri Sep 14, 2012 2:45 pm

I had same issue, so to workaround it I had to delete that line with readOnly in it and later on outside the loop do:
Code: Select all
forms[frm].controller.readOnly = true;
Tom Parry
Prospect IT
Java/C++/Servoy/Jasper Reports/Simulation/Service Applications
http://www.prospect-saas.biz
Thomas Parry
 
Posts: 498
Joined: Thu Jan 10, 2008 8:48 pm
Location: Ottawa, Canada

Re: The property readOnly is undefined ... type RuntimeCompo

Postby Harjo » Fri Sep 14, 2012 3:17 pm

than problably you have label, or something else than a real field, with a name that starts with fld_

on such element there is no property, readOnly

you could output wich element it is with:

Code: Select all
application.output(elements[allNames[i]])
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: The property readOnly is undefined ... type RuntimeCompo

Postby mmuntean » Fri Sep 14, 2012 4:49 pm

Didn't find in Sample Solutions code: elements[allNames[i]].readOnly = false. I found, instead, elements[allNames[i]]['readOnly'] = false, which works fine.
mmuntean
 
Posts: 3
Joined: Fri Jun 08, 2012 2:41 pm
Location: Timisoara

Re: The property readOnly is undefined ... type RuntimeCompo

Postby Mark Crichton » Fri Sep 14, 2012 10:22 pm

Thanks everyone for your input

After checking I found the following:
All my fields were real fields so not the problem in this case. I tested each with elements.fld_linbcc.readOnly = true and got no warning.
Also ran the output and got just text and html areas.

I am unable to do the readOnly at the form level as am switching fields based on different conditions.

mmuntean's solution is the best option. A quick replace fixed all the occurrences and now all warnings have gone away :mrgreen:
Mark Crichton
DataWise Ltd - New Zealand
http://www.datawise.co.nz
User avatar
Mark Crichton
 
Posts: 109
Joined: Mon Jan 24, 2011 10:01 am
Location: Auckland, New Zealand


Return to Forms

Who is online

Users browsing this forum: No registered users and 5 guests

cron