Hi All
I am using the script below with a button on click event.
When I add this script with the Dialog Message like below it still deletes the entry if I cancel.
How can I get the Dialog message to work if I click cancel so that it wont delete the entry with the code I have.
I am using the script below with a button on click event.
PHP Code:
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$--
-- Get the selected row number. If nothinh is selected, do nothing
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&--
tSelected = ListBox.GetSelected("ListBox_SiteList");
if tSelected then
nSelected = tSelected[1];
tItemRowNumber = String.ToNumber(ListBox.GetItemData("ListBox_SiteList", tSelected[1]));
--Delete the entry from the database
SQLite.Query(db, "DELETE FROM Websites WHERE RecordID = '" .. tWebsites.Data[tItemRowNumber]["RecordID"] .. "'");
nLastError = Application.GetLastError();
if nLastError ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
end
FillSitesList();
-- Reselect the next item in the list...
nReselect = nSelected;
nNumItems = ListBox.GetCount("ListBox_SiteList");
if(nNumItems > 0)then
if(nReselect > nNumItems)then
nReselect = nNumItems;
end
ListBox.SelectItem("ListBox_SiteList",nReselect);
end
end
When I add this script with the Dialog Message like below it still deletes the entry if I cancel.
PHP Code:
result = Dialog.Message("Warning", "Are you sure you want to DELETE this entry.", MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1);
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$--
-- Get the selected row number. If nothinh is selected, do nothing
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&--
tSelected = ListBox.GetSelected("ListBox_SiteList");
if tSelected then
nSelected = tSelected[1];
tItemRowNumber = String.ToNumber(ListBox.GetItemData("ListBox_SiteList", tSelected[1]));
--Delete the entry from the database
SQLite.Query(db, "DELETE FROM Websites WHERE RecordID = '" .. tWebsites.Data[tItemRowNumber]["RecordID"] .. "'");
nLastError = Application.GetLastError();
if nLastError ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
end
FillSitesList();
-- Reselect the next item in the list...
nReselect = nSelected;
nNumItems = ListBox.GetCount("ListBox_SiteList");
if(nNumItems > 0)then
if(nReselect > nNumItems)then
nReselect = nNumItems;
end
ListBox.SelectItem("ListBox_SiteList",nReselect);
end
end
How can I get the Dialog message to work if I click cancel so that it wont delete the entry with the code I have.
Comment