The property readOnly is undefined ... type RuntimeComponent

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*].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*.indexOf(‘fld_’) >= 0){
    _
    //if it’s a field - then change color and make editable*_
    _ elements[allNames*].bgcolor = ‘#feffe4
    elements[allNames].enabled = true*

    elements[allNames*].readOnly = false*
    * }*
    Thanks Mark_

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:

forms[frm].controller.readOnly = true;

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:

application.output(elements[allNames*])*
*```*

Didn’t find in Sample Solutions code: elements[allNames_].readOnly = false. I found, instead, elements[allNames*][‘readOnly’] = false, which works fine.*_

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: