CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Problem with CCGetUserID

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 07/26/2006, 4:47 PM

PHP: I am using CCGetUserID() as a default value in a hidden text box. It works great when the user adds a new record. No problems there.
What I need it to do is update the UserID with the last user to modify the record.
All it does now is input the UserID at record creation and it never changes it when the record gets updated.
I know it's because I have it set as the default value, but how do I get it to do it all the time?
Thanks!
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
jeden


Posts: 20
Posted: 07/26/2006, 10:58 PM

If I've caught what you mean, when the record is updated you want this field to be updated with the currently logged user.

In this case the default value is filled in when the field has no value, and this usually happens when adding a new record.
In order to update it with the currently logged user, simply add a BeforeBuildUpdate event handler to the form, and add the code to change the field value, such as

$Container->UserId->Value = CCGetUserID ():

where UserId is the name of your hidden control.
Or even, you can set it immediately after the record is retrieved from the database, in this case the event handler to add is AfterExecuteSelect.

Let me know if this works.
_________________
Antonio Bello

Elapsus - Software & Solutions
http://www.elapsus.com

Developer's Corner
http://www.developer-corner.com
View profile  Send private message
ckroon

Posts: 869
Posted: 07/27/2006, 3:24 PM

Thanks Jeden
I tried it and founda couple of errors. YOu ended it with a : but I got the error to go away when I replaced it with a ; instead.

I have this in a beforebuildupdate:

$Container->userid1->Value = CCGetUserID ();

The name of the hidden field is userid1, but it deosn't work. THer are no error messages, it just doesn't put the userID in.
What am I doing wrong?

I'll paste the code:

//sitesmaster1_ds_BeforeBuildUpdate @33-E49EB2C6
function sitesmaster1_ds_BeforeBuildUpdate(& $sender)
{
$sitesmaster1_ds_BeforeBuildUpdate = true;
$Component = & $sender;
$Container = CCGetParentContainer($sender);
global $sitesmaster1; //Compatibility
//End sitesmaster1_ds_BeforeBuildUpdate

//Custom Code @100-2A29BDB7
// -------------------------
$Container->userid1->Value = CCGetUserID ();

// -------------------------
//End Custom Code

//Close sitesmaster1_ds_BeforeBuildUpdate @33-5FFE6245
return $sitesmaster1_ds_BeforeBuildUpdate;
}
//End Close sitesmaster1_ds_BeforeBuildUpdate
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
jeden


Posts: 20
Posted: 07/28/2006, 1:54 AM

Sorry for the typo error :)

Try the following:

move the code to the BeforeUpdate event (instead of BeforeBuildUpdate) - you can quickly move the code by using a less know IDE feature: select the form in the project explorer, right click on the OnBeforeBuildUpdate->CustomCode in the Properties->Events panel, select Move To->BeforeUpdate from the popup menu.

Also, change the code as follows:

$Container->userid1->SetValue (CCGetUserID ());

this should be equivalent to the assignment to the Value property, but sometimes this way works and the other one doesnt.

Hope this works :)
Antonio


_________________
Antonio Bello

Elapsus - Software & Solutions
http://www.elapsus.com

Developer's Corner
http://www.developer-corner.com
View profile  Send private message
Carsten
Posted: 07/28/2006, 11:02 AM

Yes! That did the trick!
Thanks Antonio!
:-D
Last Hero
Posted: 08/01/2006, 2:49 AM

:)))
Plz use CustomUpdate, and add parameter type = Expression, source=CCgetUserID()

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.