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

 Hide a button

Print topic Send  topic

Author Message
Alex LL
Posted: 09/16/2002, 8:38 AM

Hello everybody,

I'd like to display the "Delete" button in a record form if and only if a certain user is logged in.
I use php. I imagine to put some code in Before Show events, any hints?

thanks
george l.
Posted: 09/16/2002, 9:58 AM

Alex. Maybe you can try the "Visible" Property. Example #2 does exactly what your looking for. Read the Help Section in C.C.S for more details.

Visible

Description
This property determines whether the component is to be shown (parsed into template) or not.

Syntax
$value = $object->Visible;
$object->Visible = $value;

Specification

result
Type: Boolean


Example 2
The following code hides Update and Delete buttons if current task is not assigned to the current user.
This code would usually be placed in Before Show event of a Record form. Additional code may be needed in Before Update or Before Delete event to protect the form from being modified and submitted externally.
global $tasks;
global $DBIntranetDB;

$current_task = CCGetParam("task_id", 0);
if($current_task!=0 && CCGetUserID() != CCDLookUp("user_id_assign_to", "tasks", "task_id=" . CCToSQL($current_task, "Integer"), $DBIntranetDB)
{
$tasks->Update->Visible = False;
$tasks->Delete->Visible = False;
}






Read the Help Guide->Programming Reference->Properties Section for more details.
Alex LL
Posted: 09/17/2002, 12:39 AM

Sorry, I forgot to tell I use CC 2.0.5, not CCS.
Nicole
Posted: 09/18/2002, 12:02 AM

Alex,
you cannot hide button in CC in so easy way as in CCS. In template pattern you can hide Delete & Edit buttons (not only one of them). I suppose the easiest way is to create two forms and show/hide one of the form depending on logged in user. Please refer to the following article about hiding the forms in CC: http://www.gotocode.com/art.asp?art_id=54&

   


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.