Is there a better way than creating a series of globals for dealing with things like web order forms? In other words I have a web form. I don’t want to create a record in the DB or allow data to be entered into the DB uuntil validated. I am using globals and then inserting it into the database when the form is complete. Any other ideas or solutions I am missing?
You can use a transaction or use variables within your jsp form and send them to/through a method to create the new record after validation…
disable autosave: (servoy v3.0)
databasemanager.setAutoSave(false);
then save will never be triggered.
you can do youre validation and then call
databasemanager.setAutoSave(true);
and youre data/record is saved.
when you don’t want to save that record at all just delete the record again
(controller.deleteRecord())
johan
you can also use databasemanager.rollbackEditedRecords() then existing changed records will be rollbacked to the values from the database and new record will just be cleared from the editing records.
so
databasemanager.setAutoSave(false);
// change records, create new records
if(notValidated)
{
databasemanager.rollbackEditedRecords();
}
databasemanager.setAutoSave(true); // everything is saved (or nothing when rollback edited records was called just before it)
These are all good ideas. And thanks a lot for the complete processes! But the drawback it seems to me is that they creat a record which I then need to destroy. Globals on the other hand create no record until a submt and a validate is preform. So I have much less accessing of the database. Does anyone see a drawback to that?
no no
The record is NOT saved to the database.
The record i was talking about is the record we keep in mem before you save it.
And you don’t really have to delete the record with controller.deleteRecord() you can also do databasemanager.rollbackEditingRecords()
then new records will be discarded from memory and existing records will be rollbacked to the database data/previous state.
johan
Forgot to get back with you. I redid everything your way. Which of course was another learning experience.
It works great… thanks!