G
|
gawde 10/11/2007 |
Hi forum members, Been quite awhile since I have visited, but now I have been asked to enhance some of the features in my app and I am running into a problem that seems to be quite common, yet I can't find an answer that works for me. It maybe a version incompatiblity. First of all, this application was created using PHPR 3.1. I know, I am living in the dark ages, but just don't have the time to come up to speed on the newest PHPR version. I have made a few changes to the generated code over the years, so regenerating the code with PHPR is not really an option. What I am trying to do is an after thought, but it seems very simple and I think it is. I have a field name Principal. I have added another field named O_Principal. What I need is to populate O_Principal with the same contents as Principal when the record is first created (added). O_Principal is hidden from the add page and it is not an editable field. I want it to remain the same as long as the record exists. I will use the OPrincipal field for some comparsions later in my application. What I decided was that this would be a super place to use the AfterAdd event. Please correct me if I am wrong. So I manually created an AfterAdd function in ../includes/..events.php with these contents: function AfterAdd (&$values){ global $conn; $strSQLInsert = " insert into mos_pcmacct (O_Principal) values ('".$values["Principal"]."')"; db_exec($strSQLInsert,$conn); } I reviewed many posts and this seemed to be the proper way to do this. Maybe since I am using PHPR 3.1, this will not work. I get an error when I add new records. The error is the typical "Missing argument 1 for afteradd()" message. Can anyone see my error? Is this code compatible with PHPR 3.1? Anyone have any suggestions? Thanks in advance. Dave
|
![]() |
Sergey Kornilov admin 10/12/2007 |
Dave, |
G
|
gawde 10/12/2007 |
Dave, |
D
|
drh author 10/12/2007 |
Thanks for the posts guys. I was wondering if it was a problem with the version of PHPR I was running. Thank you Sergey for pointing that out. Any new apps I create will be done in PHPR 4.1. Unfortunately, I am kind of stuck with the app I am running. Over the last 1 1/2 years I have had to enhance and customize to meet my clients needs. Therefore, the current code could not be regenerated easily. I understand that a lot has changed in the newer versions, and I can hardly wait to try it out. |