This is how to display user messages from within functions
I found a useful way to display error messages to users from within functions. This seems to work in all uses of functions except in perma views.
1. Set up a form to store the messages:
#Message_Number (Number field)
#Message (Rich Text field)
2. Create a view for these messages and call it User_Message
3. Create records for each message you plan to use in your application.
4. Create this function (remember the 'void
misc.display_message......' may have to be changed depending where you store your function):
- void misc.display_message(int message_no)
- {
- message = "#View:User_Message?zc_LoadIn=dialog&Message_No=" + input.message_no + "&zc_Header=false&zc_Footer=false&zc_SecHeader=false&zc_AddRec=false&zc_EditRec=false&zc_DelRec=true&zc_DuplRec=false&zc_EditBulkRec=false&zc_Filter=false&zc_Search=false&zc_SumRow=false&zc_Summary=false&zc_RecSelect=false&zc_SaveRec=false";
- openUrl(message, "Popup window", "height=100, width=100");
- }
5. Whenever you need to display a message, call the function with the relevant message number like this:
- thisapp.misc.display_message(1);
Where '1' in this case is message number 1. The OPENURL part of the function opens a dialog window with the message displayed. Something like this (sorry, image slightly truncated):