I have the below code failing in Mac – not failing in Windows – in Servoy Client and Developer 3.58 and 3.59. It asks my dialog question, but when the users answers “Cancel” in Mac, it does the “OK” code. Can’t see a reason for it, doesn’t fail if Developer is running with debugger enabled. I am firing the method from onFocusGained, but it fires fine – just doesn’t seem to notice they’ve chosen Cancel from the dialog. Bug?
var Sure = plugins.dialogs.showWarningDialog('Confirm', 'Are you sure you want to mark this item NA?, 'OK', 'Cancel')
if (Sure == "OK")
{
contractmilestone_to_tblrelatebudgetmilestone.na_yn = 1
contractmilestone_to_tblrelatebudgetmilestone.forecast_date = null
contractmilestone_to_tblrelatebudgetmilestone.actual_date = null
contractmilestone_to_tblrelatebudgetmilestone.VCdate = null
contractmilestone_to_tblrelatebudgetmilestone.VCtype = null
databaseManager.saveData()
}
added the below but it didn’t help…
else
{
return
}
Are you sure it goes through that if (you could add an application.output) ? Is it reproduceable in a small sample ? If so, please open a case in our support system.
Hi Ellen,
var Sure = plugins.dialogs.showWarningDialog('Confirm', 'Are you sure you want to mark this item NA?, 'OK', 'Cancel')
I think you are missing a single quote at the end of your dialog message.
The following should work.
var Sure = plugins.dialogs.showWarningDialog('Confirm', 'Are you sure you want to mark this item NA?', 'OK', 'Cancel')
Er… sorry, that was just a typo for posting here – I shortened the dialog. The complete code for the whole method reads like this:
elements.phase_id.requestFocus()
if (gprojectone_to_tblrelateprojectmilestone.na_yn == 1)
{
gprojectone_to_tblrelateprojectmilestone.na_yn = null
databaseManager.saveData()
}
else
{
var sure = plugins.dialogs.showWarningDialog('Confirm', 'Are you sure you want to mark this item Not Applicable? This will clear all date information for this phase. There is no undo.', 'OK', 'Cancel')
if (sure == "OK")
{
gprojectone_to_tblrelateprojectmilestone.na_yn = 1
gprojectone_to_tblrelateprojectmilestone.forecast_date = null
gprojectone_to_tblrelateprojectmilestone.actual_date = null
gprojectone_to_tblrelateprojectmilestone.VCdate = null
gprojectone_to_tblrelateprojectmilestone.VCtype = null
databaseManager.saveData()
}
else
{
return
}
}
Totally bizarre that it would execute the OK code when the user answers Cancel – and only on Mac. Fine on windows.
and the opposite is also true?
so if people press OK you get Cancel en if they press Cancel you get OK ?