![]() Code behind Force Close button simply ignores the state of modified and closes the form (or redirects) after confirming the action with the user.Code behind “Close” button checks if “modified” is set to “Unsaved”, and if so, hides the Close button, shows the Force Close button and displays a warning message to the user.Set up toolbar accordingly with the two buttons defined - do not specify the standard "cancel" or "exit" buttons.Within event onLoad set button Close to visible, but hide button Force Close.Add my own Close button (type ajax), and a Force Close button (also type ajax) - this is required because I can’t work out how to add any code to SC’s own Close and Exit buttons - they don’t seem to have any events to allow you to trap when these buttons are clicked.Add code to event onValidateFailed to change “modified” back to “Unsaved”.Add an event to handle form submit to reset modified to ‘Saved’ and set up buttons (see additional note below).I have found through experimentation that OnChange does not work for radio button fields - looks like a bug - so I just use OnClick - and no, if you click twice to reset back to it's original value "modified" does not revert to Saved - I am keeping it simple and I rather be cautious and say Unsaved rather than make the code over-complicated. Add an event to each field (onChange, or onClick if radio button) which calls the above js method to set accordingly.I use a js method for this because I have found the sc macros to change the look of fields are flakey at best. Add a javascript method which sets the field “modified” to “Saved” or “Unsaved” plus sets foreground and background colours to make it stand out when “Unsaved”.The label reads “This information is…” and the field displays “Saved” or “Unsaved” ![]() I am hoping the community may have some Here are my notes… Keep in mind I don’t have much of a web development background, mainly enterprise applications, so I am not advocating this as a “best practice”, but it works for me.īasically the approach I use is as follows: To be clear, I want to retain the use of tabs (not remove them completely) - they are very useful in allowing app switching in the context of my business scenario. The last piece to preventing accidental closure of an app with data changes outstanding would be to prevent the user from closing the app via the ‘x’ on the tab. So my approach is to warn the user that there are unsaved changes and ask them to save the record. It would be nice if SC had a call to programmatically save the changes of the current record, but I have not found one. ![]() Next I have implemented my own Close button - it uses the same framework to check if there are unsaved changes before closing the form. To work around this issue I have implemented a framework which visually tells the user the current state of the record (unsaved) - this is all triggered via change events. The worst case scenario is that they become distracted (phone call etc) and forget they have not saved the record and leave the app thinking that changes have been made, but in fact they have not been applied. They need to re-open the app, find the record they changed and re-do the changes, and save it. Does anyone know how I can disable or remove the ‘x’ on the tab?Įssentially users have become tired of accidentally closing apps where data changes have been made but they have not saved the changes. I just want the tab to allow switching between apps, and apps are closed via a ‘Close’ button in the app itself. I need to completely remove, or disable, the functionality to close these tabs via the ‘X’ that appears on the tab. Most of my projects use tabs, with a tab opening each time a new app is spawned from the menu. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |