I get an error when the following code is executed. I’m trying to re-set a field as “un-editable” on a form.
if ( globals.returnedNameId )
{
tknameid=globals.returnedNameId
globals.fn=timekeeper_to_name.namefirst
globals.ln=timekeeper_to_name.namelast
globals.mn=timekeeper_to_name.namemiddle
forms.tkAdd.elements.fn.edit=false <— Error says Java class “com.servoy.j2db.dataui.DataField” has no public instance field or method named “edit”.
}
else
{
answer=plugins.dialogs.showDialog( ‘Name record was not entered or selected…’, ‘Do you want to try again?’, ‘No’, ‘Yes’ )
if ( answer= ‘Yes’ )
{
tkSearchNames();
}
else
{
return
}
}
It does not work with “editable” either. Can someone please tell me the correct syntax?
I don’t know much about this, but it look like the first If statment is missing a correct equasion. it says “if ( globals.nnnnnn)” instead of “if (globals.nnnnnn = x)”
Good code…is a very easy way of doing
if(globals.returnedNameId != null && globals.returnedNameId != “”)
forms.tkAdd.elements.fn.edit=false <— Error says Java class “com.servoy.j2db.dataui.DataField” has no public instance field or method named “edit”.
you can disable foields by doing this:
forms.tkAdd.elements.fn.enabled = false
So replace “edit” with “enabled”
BTW: how did you come up with this code?
If you use the auto generated code by clicking through the method editor
you’ll never end up with that code, unless you manually type it.
I don’t mean to be insulting here ,
because maybe you’re misinformed by some docs or post out there ?
No insult taken. The code I sent was the result of a number of attempts to divine the correct syntax by trial and error typing. I started off with the “enable” property clicked from the Method editor, but abandoned it because it also greyed out the text.
I re-applied your suggested code, but now have to ask if the greyed-out foreground color can be overridden. I tried:
I noticed using Version R2 1.2rc9-build 259 that comboboxes cannot have the editable property assigned on a form via a method. Is this an oversight or intentional?