Hi all,
I use the method “checkStatus” on DataChange on a field with radiobuttons. Valuelist = open, ready, approved.
When the value ‘approved’ is selected, the field must not be changed to another value again.
This is the method:
if (dev_status == “approved”)
{
dev_status_final = 1
}
else
{
if (dev_status_final == 1)
{
//set the dev_status on ‘approved’ again
dev_status = “approved”;
application.beep();
//show dialog
plugins.dialogs.showWarningDialog(‘Attention’, ‘This record can not be modified anymore’,‘OK’)
}
}
There are some bells ringin’ that say that this way of securing a field can be done a bit better… Anybody got some good alternatives? The dev_status field doesn’t show “approved” when I hit the ‘OK’ button in the warning dialog either… ![Sad :(]()
what about setting the editable property to false if the dev_status == “approved”? You could do this onShow for the form and onDatachange for dev_status.
Thank you DFehrenbach for the tip. How does the method look like, when I want to set the editable property to false?
Got it allready. This is what I did:
Run this method on Form property ‘OnShow’ and ‘OnRecordSelection’
if (dev_status == “Approved”)
{
controller.readOnly = true ;
}
else
{
controller.readOnly = false
}
The user cannot even think about editing any field in the from! ![Very Happy :D]()
I just like Servoy better and better!
Good! Don’t forget onDatachanged (or onLostFocus) for dev_status so that once your user changes the field to “approved”, the data will be protected immediately- otherwise it wont be protected untill the next time the form is shown or record is selected.