Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Extra Action Button that saves record and runs report

Post Reply
FBC-Tim
Posts: 25
Joined: Thu Jun 23, 2011 6:08 am

Extra Action Button that saves record and runs report

Unread post by FBC-Tim »

I have an Extra Action Button that prints a report and I want to make sure the report always prints what the user can see on the edit form. If the user presses my button after editing some fields their unsaved edits do not show on the report.
The Sample Debtors example application also has the same problem. On the index form press the Invoicing button, press Add Record to make a new invoice, select a customer / invoice type / and add an item, press Save. When the edit form has reloaded after saving enter two more items, press the Print Quote button and the two items just entered are not on the report.

I have thought of two ways of fixing this problem ...

1. Is there a JavaScript variable available that says if the user has changed any data on the edit form?
The code in my Extra Action Button could check a flag to see if the user has changed any data on the edit form. If the flag shows that data has been changed and not saved I could show an alert to the user saying, "Please save your changes before printing this report", and quit.

2. How to call SaveThis() asynchronously without reloading the edit form?
I tried to use the SaveThis() function to save the record before calling the report. This did work, but not consistently every time. The record is saved and the report generated but not always in the correct order. The SaveThis function call also causes the edit form to reload. After spending some time trying to get this to work, I don't think it is possible to get this in the correct order because of the way JavaScript runs?

I'm hoping you have a flag available to use for option 1 :?:
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Extra Action Button that saves record and runs report

Unread post by admin »

FBC-Tim,

I think (1) is your best option.

The field you are looking for is document.getElementById('beenedited').value

if it equals '1' something has been edited.

This should do it.

Steven
Post Reply