CodeChargenewbie
Posts: 114
|
| Posted: 11/05/2007, 7:02 AM |
|
I'm getting a "trying to get property of non-object error" in php custom code. The code in question is global, meaning it's not contained inside a beforeshow script or anything of the sort. In fact, it's in a white space between two sections of gray code. Here's the code:
global $NewForm;
CCSetSession("NumID", 401);
$NewForm->ID->SetValue(CCGetSession("NumID", 0));
The error occurs on last line of the code above. What am I doing wrong?
Thank you.
|
 |
 |
ckroon
Posts: 869
|
| Posted: 11/05/2007, 8:33 PM |
|
My guess would be that the form object: "ID" doesn't exist.
Check the name of that field in the properties box.
Also check that the form's name is indeed "NewForm"
Of course, I may be way off base...I am like a stopped clock, right at least once a day. :)
_________________
Walter Kempees...you are dearly missed. |
 |
 |
ReneS
Posts: 225
|
| Posted: 11/06/2007, 3:13 AM |
|
right twice a day
|
 |
 |
CodeChargenewbie
Posts: 114
|
| Posted: 11/06/2007, 6:06 AM |
|
It's usually the most obvious oversights, which is why I checked the existence and spelling of the form and field name of the code in question. More over, if the same code is moved into say, beforeshow custom code event, sans global $NewForm because it doesn't need to be declared in the before show event, it works perfectly fine. Yet, outside of custom code events, it gives the error as written above. Strange.
|
 |
 |
ckroon
Posts: 869
|
| Posted: 11/06/2007, 6:49 AM |
|
re:right twice a day...
Ahh.. but I am a digital clock
_________________
Walter Kempees...you are dearly missed. |
 |
 |
|