gpearson
Posts: 4
|
| Posted: 03/15/2005, 5:34 AM |
|
I have a multi-step form which I am currently using codecharge to create. Now I would to know if it is possible instead of codecharge to access the database on each form, if it is possible to write the information into an array and on the last step of the form, then write the entire array to the database.
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/15/2005, 11:01 AM |
|
It may be possible but probably can be quite complex as you would need to pass the whole array from page to page, probably via a URL. Your URL could become very long and contain all the user's information.
Alternatively you could try saving an array into a session variable, but most people try to avoid sessions. I don't know how else you could pass the information between 2 different programs (pages).
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
dataobjx
Posts: 181
|
| Posted: 03/15/2005, 12:50 PM |
|
Mr. Pearson, I'm assuming that you're thinking that you only want the data to go into the database when the last page has been completed...
If this is the case, you could also try to use Hidden Forms, passing the information from page to page by populating each hidden field via the Request.Form("field_name") method.
None of the fields in the wizard pages would actually be linked to the Database fields until the final page at which point the hidden fields are linked / bound to the database fields.
When the user hits the submit on the final page, the hidden field values which are bound to the database fields (on this page only) would then be submitted.
_________________
www.DataObjx.net
www.mydigitalapps.com |
 |
 |
gpearson
Posts: 4
|
| Posted: 03/16/2005, 2:36 PM |
|
Quote :It may be possible but probably can be quite complex as you would need to pass the whole array from page to page, probably via a URL. Your URL could become very long and contain all the user's information.
My thought would be that the array would be apart of the Session Scope of PHP, ASP and Coldfusion. WIth the array apart of the session, it would not have to be passed to each page. This would also have benefit over the hidden form variables which would have to be on all pages. Everytime I have completed a form, each screen upon submit has accessed the database for either an update or insert and I am not sure how to do this. I figured I would have to modify the code after CCS has generated the code to bypass the database routines but have not started this little project so it can be shared with the rest of the group.
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/16/2005, 2:59 PM |
|
I think that there is no automatic session scope in those enviornments except when you create session variables. A variable is not automatically a session variable. However as I wrote above you could create a session variable and store information in it. I just see everyone trying to use as little session variables as possible to preserve server's memory. It actually would look like quite unusual and unreliable solution to me. When storing information in the database you can also implement ways to recover from a server crash, Internet service interruption, and other issues (though maybe it's not needed in this specific example). Anyway, each script is a different program and there are only a few ways for those programs to communicate: via GET (URL), POST (hidden fields) and sessions. You can pick your method.
You don't need to connect a Record form to a database. It will then function just like a Search form - by submitting parameters to your page/program/script, where in turn you can create your session variables/arrays and redirect the user to another page to continue.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
RonB
Posts: 228
|
| Posted: 03/18/2005, 12:30 AM |
|
With mysql you could create a temporary table holding the information. At the last step of the form you could then get that stored information and add it to the permanent table. Look for temporary tables in mysql documentation.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 03/18/2005, 2:17 AM |
|
I have found easy to handle just write the information to the File on every form, but have one field flag that you only set true if the last form was submited, by the end of the day or a task process delete all record with that flags not set to true. (Super Easy and Simple)
(Like a Simulation of transactional in a web enviroment)
Avoid Session variable, will waste lot of Server memory.
Few Hoster are Canceling account for Session variable abuse.
(we do hosting a we have talk to few hoster cuase this)
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
fotrane
Posts: 13
|
| Posted: 03/28/2005, 6:09 AM |
|
In Codecharge 2.0, I was able to use mysql_last_insert, which does not seem to work at all in CCS. I am currenty using a session variable assigned "After Insert". How much of a memory hit does the server really take doingn something like this? I have been using CC & CCS since the first release of both, and to this day it still bothers me that CCS does not allow you the flexibility that CodeCharge does.
|
 |
 |
Nicole
Posts: 586
|
| Posted: 03/28/2005, 6:16 AM |
|
You CAN use mysql_insert_id() in CCS project to retrieve auto increment primary key value in After Execute Insert event using code:
global $form_name;
$LastID = mysql_insert_id($form_name->ds->Link_ID);
Keep in mind that you need to use real form name in your code.
_________________
Regards,
Nicole |
 |
 |