CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 CCS Server Events (before show row)

Print topic Send  topic

Author Message
Scott S
Posted: 05/13/2002, 5:06 PM

I tried using the before show row event to check a field in a row against a value (basically to implement some custom security). No luck...
Any examples or docs on the server side events or anyone have some code like this?
Thanks!
Nicole
Posted: 05/14/2002, 4:25 AM

Scott,
well, the problem is to access field value I suppose. Is it so?
To do it try following code:
PHP
global $form_name;
//get value
echo $form_name->field_name->Value;
//set value
$form_name->field_name->SetValue("new value");

ASP
' get value
response.write form_name.field_name.value
' set value
form_name.field_name.value = "new value"
Alex Alexapolsky
Posted: 05/14/2002, 4:27 AM

What code did you put there ?
Scott
Posted: 05/14/2002, 5:16 AM

Well, what I did was click on the grid control, then I clicked on events, then the before show row. In the properties for before show row, I set the control value to "securitylevel" (a field in the database) then I set the compare value to a number (9 for example).

I guess the problem I have is that I did not see any documentation on how this is supposed to work, so I am really just guessing....
Scott S.
Posted: 05/18/2002, 8:43 AM

Maybe there is a better way to do it, but im trying to use the build in CCS stuff. I added an event for the GRID, Before Show Row -> Validate Minimum Value.

For properties, I specified:
Control Name: owner (a number field in my database)
Minimum value: 9999 (only 1 record has this value for testing purposes)
Error Message: ACCESS DENIED

So it generated this code:

//Validate Minimum Value @32-9EDAB7A4
global $numbers;
if ($numbers->owner->Value < 9999)
{
$numbers->owner->Errors->addError("ACCESS DENIED");
}
//End Validate Minimum Value


Im fairly new to PHP, but the code seems to make sense to me... If the Value of the owner field in the numbers table is less than 9999, it will "addError" "ACCESS DENIED"...

But, when the grid prints in my browser, I see all the rows, the 9999 row, and all the ones that are less than 9999. No error message.

Im still trying to learn code charge too, so maybe there is a better way to do this... basically I just want to make sure the user that is logged in only has access to his groups records or any groups id's that are lower in value.

For example, if my group id is 9999, I should see all records.
But, if my groups id is 30, I will only see records that are 30 or less....
(record level security in the grid...)
maybe I need to add a where clause instead (just thinking out loud now)? hmm.. maybe ill try that now...

Your help is greatly appriciated!
Scott S.
Posted: 05/19/2002, 4:04 AM

Hmmm... starting to get frustrated... I want to implement record level security....

I tried the where clause, and that actually partially worked if I hard code a number, but I dont see a way to make the where clause use a variable, or what the variable is for groupid...

Any help is greatly appreciated!

   


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

Web Database

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.