kirchaj
Posts: 215
|
Posted: 08/04/2016, 2:25 PM |
|
I am trying to location the codecharge support solution describe in this post
http://www.codechargesupport.com/blog/index.php?action=More&post_id=2
but the site is no longer available
supposedly you can add a new record and immediately return to the form in edit mode with no programming. Looking for the easy way to do this :)
|
|
|
eratech
Posts: 513
|
Posted: 08/18/2016, 6:32 AM |
|
Yep - *almost* no programming to add record and add ID to query string to load page in Edit mode.
Will try and dig out example tomorrow
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
kirchaj
Posts: 215
|
Posted: 08/18/2016, 1:03 PM |
|
Thanks Eric. I would really appreciate the assistance.
Tony
|
|
|
eratech
Posts: 513
|
Posted: 08/19/2016, 12:42 AM |
|
@kirchaj
The rough guide to adding a new record and then returning to that page in edit mode:
1) set up the Record as usual and allow Insert and Update
2) In the Record 'After Execute Insert add 'Declare Variable' of something like:
Name: latest_id
Type: Integer
Initial Value: mysqli_insert_id($Component->DataSource->Link_ID)
as this will return the ID of the latest inserted record. Make sure you use the '$Component->DataSource->Link_ID' otherwise MySQL/CCS might not return the right ID.
3) in After Insert, add Custom code with something like:
// get the ID into this scope:
global $latest_id;
if ($latest_id > 1) {
// optional - update another table, or queue an email etc
}
// stay on the same page (I've hardcoded 'newrecord_maint' for example)
// and the ID will automatically set the page to Edit if the ID is found
global $Redirect;
$Redirect = "newrecord_maint.php?id=".$latest_id."";
Cheers
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
|