web order forms

Forum to discuss the Web client version of Servoy.

web order forms

Postby mmcmanus » Tue Feb 28, 2006 5:20 pm

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?
mmcmanus
 
Posts: 41
Joined: Thu Feb 23, 2006 7:28 pm
Location: Cincinnati, OH

Postby IT2Be » Tue Feb 28, 2006 7:39 pm

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...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby jcompagner » Thu Mar 02, 2006 2:28 pm

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
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby jcompagner » Thu Mar 02, 2006 2:41 pm

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)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

all good

Postby mmcmanus » Thu Mar 02, 2006 3:22 pm

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?
mmcmanus
 
Posts: 41
Joined: Thu Feb 23, 2006 7:28 pm
Location: Cincinnati, OH

Postby jcompagner » Thu Mar 02, 2006 5:42 pm

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
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

web order forms

Postby mmcmanus » Fri Mar 17, 2006 5:12 pm

Forgot to get back with you. I redid everything your way. Which of course was another learning experience.

It works great... thanks!
mmcmanus
 
Posts: 41
Joined: Thu Feb 23, 2006 7:28 pm
Location: Cincinnati, OH


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 2 guests