I have a form that displays the records from a table in list view. One of the fields I want to set to either editable or uneditable based on a value in that field. This field is set to editable in the field properties. I have a method that is executed onShow that checks the value and sets the readOnly property to true and the enabled property to false if the property is greater than 1 (code below). The problem I am finding is that if one fields is set to uneditable, they all are. How do I get just the desired fields to be uneditable but allow the rest to be edited?
for ( var i = 1 ; i <= controller.getMaxRecordIndex() ; i++ ) {
controller.setSelectedIndex(i).
if (posted > 1) {
elements.checkbox1.enabled = false
elements.checkbox1.readOnly = true
}
}
FYI posted is the dataProvider for the field in question.
You could try having two elements 1 being your field for editing and the second being a text label version of the field - if you displaytags you will get the same result as the field. Then as far as I can see change your code to :
…and vice verse - this as far as I can see will switch one or the other on/off as required. How you get the tick to display nicely is another problem you may have to fiddle with!
Thanks for your suggestion, but I do not think it will work because as Marcel mentions above,
in list and table view it is all or nothing when you talk about properties.
Marcel,
Thank you for your response too.
The solution I have decided on is to execute the following code onDataChange:
var oldValue = arguments[0]
if (1 < oldValue) {
plugins.dialogs.showErrorDialog('ERROR', 'This record has already been posted and can not be changed.', 'OK')
posted = oldValue
}