kburnett
|
| Posted: 08/15/2002, 2:17 PM |
|
i have a record on which i use a custom query to join in another table. this works just fine. the problem comes with the custom insert or update. i use those because ccs will add the joined table to the insert or udpate syntax which is clearly not correct.
here's the rub: when i created the custom insert or update it worked just fine for a while. somewhere along the way it crapped out and now gives me a "Call to a member function on a non-object..." error on insert of update. the line of that the error points to is the function insert of function update code.
what gives? why would a custom insert or update suddenly stop working? more specifically, why would a custom insert or update suddenly forget that the object it has is a member of the class contianing the insert and update functions?
curious.
|
|
|
 |
kburnett
|
| Posted: 08/15/2002, 2:49 PM |
|
and strangly, the custom delete works just fine.
hmmm.
|
|
|
 |
kburnett
|
| Posted: 08/15/2002, 4:51 PM |
|
more wierdness...
if i convert the custom updated from type "table" to "sql" the insert begins to work. the update, however, still gives the "Call to a member function on a non-object..." error.
hmmm.
|
|
|
 |
Nicole
|
| Posted: 08/16/2002, 3:07 AM |
|
Hello,
please let me know what sql statement do you use to insert and update. And what line of code do you get the error for?
|
|
|
 |
kburnett
|
| Posted: 08/16/2002, 9:44 AM |
|
the sql statement is:
UPDATE brew_content SET issue_id={issue_id}, headline='{headline}', content='{content}' WHERE id = {id}
and it set to look for the parameters:
issue_id
headline
content
id
*that is the default statement created when i convert it from "table" to "sql" type. but it reads correctly.
the error message:
would tell me "Call to a member function on a non-object..." and then a line number - in both cases reading...
$this->ds->issue->SetValue($this->issue->GetValue());
the problem, as i discovered is that my field is called issue_id. how it went form issue_id to issue in the php i don't know (maybe i had it called issue at one point, who knows.) so regenerated the code, and it worked.
here's the funny thing... i am noticing that ccs does not always regenerate the code automatically. i make changes and those changes sometimes take a lot of work to get to appear. like i have to right click on a page and choose "regenerate" to make it happen.
anyhow, thanks for the help.
|
|
|
 |
Nicole
|
| Posted: 08/19/2002, 2:21 AM |
|
Hello,
to set value to the field of the form in one of the action server side events use code:
global $form_name;
$form_name->ds->field_name->SetValue($form_name->ds->field_name->GetValue());
In case you're using e.g. Before Show Row event use code:
$form_name->field_name->SetValue($form_name->field_name->GetValue());
As for code regeneration, when you edit generated code directly in CCS code editor the edited lines and some lines around them become highlighted in white. Please check if you have white sections in the code. If yes, please back up custom modifications, remove the file code in code editor and regenerate the page. In this case all the necessary code should generate again.
|
|
|
 |
Silver
|
| Posted: 08/21/2002, 12:42 AM |
|
ok..I'm trying to do the same thing here I always get something like undefined function "tosql" or "setvalue" or what ever function I use.
please help me Nicole !
Thanks
|
|
|
 |
Nicole
|
| Posted: 08/21/2002, 5:19 AM |
|
Silver,
what exact error do you get?
|
|
|
 |
Silver
|
| Posted: 08/21/2002, 11:03 AM |
|
thanks Nicole for your concern:
The error is this: Call to undefined function tosql.....the problem is that I'm writing from an internet cafe for now so I don't have the erroor message handy right now.I'm sorry
Anyhow, My question is : do I need to include files or declare functions before I use them in custom events like "After Insert" ??
Thanks again...you are wonderful.
|
|
|
 |