CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Forum Sample from the Solutions Pack.

Print topic Send  topic

Author Message
Wreckmaster

Posts: 48
Posted: 01/24/2012, 9:52 AM

Hi I am working on the Forum Sample from the Solutions Pack.

So far so good I have applied security in so much as posts are now made by logged in members with , users table, user_id and user_login.

On the View Thread page I would like to add an Edit Button to the response, but this can only be visible to the member who owns the post.
I have tried show-hide component in the before show event unsuccessfully .

This functionality was implemented on this forum back in 2006 see here
http://forums.codecharge.com/posts.php?post_id=75335

Any and all help would be appreciated.
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 01/24/2012, 5:33 PM

This is a general approach, would require more detail but should help get you started:

1. Have a hidden field on the form whose source is the creators userid that was stored in the record for that post, read the value and declare it a variable for use in a comparison.
2. Make sure the edit button visible property is dynamic.
3. In the before show event for the form add some custom code.

// Read the value of userid from the from and declare it as a variable called "$userid"

Custom Code

$userid = $formname->userid->GetValue():

// Compare the variable $userid with the current user session variable "UserID" and set the button visible if equal, or not visible if not equal

If (CCGetSession("UserID") == $userid)
$form->Button_Edit->visible = True;

If (CCGetSession("UserID") != $userid)
$form->Button_Edit->visible = False;

Also, play with having the form features set to update panel. This is not always the recommended but it gives a good feel for seeing fluid hiding and showing of dynamic components.

_________________
Central Coast, NSW, Australia.

View profile  Send private message
Wreckmaster

Posts: 48
Posted: 01/25/2012, 1:31 PM

Closed - Resolved
By setting the link Visible property to Dynamic I have archived this, with the Hide-Show Component in the before show event. By comparing the userid (link) to the session user id .

Thanks for help

Mick
View profile  Send private message

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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