I have a form People with a tab panel on it called Addresses. The People table has a field on it called id_addresses_mailing which holds the primary mailing address id for this person. There is a calculated field on the addresses form called PrimaryAddress which compares the address id in the people table with the address id in the current address record and if they match, sets the PrimaryAddress to true.
That all works fine.
If the user clicks on the PrimaryAddress field I have some code which checks to see if there is a different address set as primary and if so pops up a message box asking the user if they want to change the primary address. If they say yes, the PrimaryAddress field is set to true and the address id in the people table is updated.
All of this worked fine with build 319 and prior, but does not work any longer with build 320.
With build 320, if the user first clicks into the address record and then clicks on the PrimaryAddress field, the code runs fine, BUT if they are on one address and then click directly onto the PrimaryAddress field in a different record – it doesn’t work (but does in build 319 and prior).
Here is a copy of the code that runs on the onDataChange event of the PrimaryAddress field.
if ((forms.people.id_addresses_mailing > 0) && (PrimaryAddress == 1) && (forms.people.id_addresses_mailing != id_addresses_mailing)) {
var myMsg = "The primary address for this record has already been set to Address #" + forms.people.id_addresses_mailing + ". Are you sure you want to change it?"
var retVal = plugins.dialogs.showQuestionDialog( "Primary Address Already Set", myMsg , 'Yes', 'No', 'Cancel')
if (retVal == 'Yes') {
forms.people.id_addresses_mailing = id_addresses_mailing
forms.people.controller.saveData()
databaseManager.refreshRecordFromDatabase(forms.people.people_have_addresses_mailing, -1)
}
else {
PrimaryAddress = 0
}
}
else {
forms.people.id_addresses_mailing = id_addresses_mailing
}
Any help that you can give to resolve this problem would be appreciated.
I have a small sample that I can send you if need be.
Thanks for your help.