I have a form with a tabpanel on it. The tabpanel has some fields which, programmatically, using a onLoad method (attached to the tab panel form), I make readonly.
This is the problem:
When I test the method by going into edit mode within developer, on the “parent” form, the fields on the tab panel remain read-write.
If I open up the tab panel form, the method runs correctly and the fields become readonly.
If I run thru the method, on the “parent” form, in debug mode, clicking thru the entry breaks, the method runs ok and the fields become readonly.
Dex, have you tried using the OnShow method on your tab instead of OnLoad? In some situations, you may want to attach a method to the OnRecordChange property, eg when the user can navigate through different records and the element properties are conditional on the values of certain fields in each record.
You can also have an OnShow method on the parent form which calls the method on the tab form.
Thanks for your responses. Basically I ended up changing it to an onShow method as I couldnt figure out why it wasnt working (especially as it would work in debug mode). I suppose its avoiding the problem (as opposed to dealing with it), but needs must…
What I mean is, I still don’t understand why the method wont run properly as an onLoad. It does run OK as an onShow, so thats the way I am going to use it. At this point it makes little difference which condition the method runs under.
So, the problem has not necessarily been solved, just avoided.
So, the problem has not necessarily been solved, just avoided.
Not really!
Onload is only fired… on loading the form.
In your case I presume you wnat to set the fields to readonly dynamically. So, you NEED onShow and this is NOT avoiding a problem.
When you don’t need to set it dynamically you can use the properties(-bar) to set it.
Ideally, the method should be run only when the form is loaded. The fact that it wont do this (although it will in debug mode under the same conditions) is avoided by using the method as an onShow instead.
There really is a bug on the readOnly property of 2.2.7. I have three tabs that use that property every time the screen is shown, as well as when they change a global on the parent tab. They’ve worked for two years to control the editability of text fields. Suddenly they don’t work any more – and the only change is that I made those tabs relationless a week ago, performing the search for records myself onShow rather than using a related tab.
Sounds convoluted I know, but I am saying I debug the method written two years ago and used in production since: it gets to the line that exactly specifies (yes I’m sure it’s spelled correctly) the text area element to be readOnly = false and it doesn’t re-open its editability. Nope, nothing else is firing to re-readOnly the field, and the line is firing. To solve, I have had to switch to the property enabled to control the text fields editability.
Interestingly, the same code works on radio buttons and comboboxes, it’s just failing to work on text areas.