stephenlau
Posts: 13
|
| Posted: 08/01/2008, 2:22 AM |
|
Hi,
I have read some posts about button disable in Javascript but it is done in client side which seems to be dangerous to me as I want to disable the button to avoid unauthorized people to do the button action. Therefore, I think I have to disable the button in server side.
Is there any property to make it?
or something like this:
// BeforeShow
if ($var == 0)
$formA->buttonA->disable = true;
I dun want to use ->visible = false as this will change my layout.
Can anyone give me some invaluable advice/suggestion?
Thanks a lot 
_________________
. |
 |
 |
datadoit
|
| Posted: 08/01/2008, 5:57 AM |
|
Just an idea... How about using styled image buttons instead? Then just
replace the style or image based on your condition. One will have an
action, the other will not.
|
|
|
 |
stephenlau
Posts: 13
|
| Posted: 08/04/2008, 1:36 AM |
|
thanks a lot.
Can you tell me more about it?
Where can I find the styled image buttons?
Is it a built-in CCS function?
_________________
. |
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/04/2008, 8:41 AM |
|
This is far more simple than you both think.
Reference:
Helpfile, search for: Attribute
Read subjects:
- Component Attributes
- Working with Attributes of components.
Actually the help gives source example for exactly what you want.
In short:
Open the page with your Button on it in HTML mode.
Find the Button line, position mouse cursor just before the closing >
right click from menu choose insert attribute, give attribute a name to remember f.i. disable.
Save, switch to BeforeShow of that Button, insert your condition as follows:
if ( your condition here )
$Component->Attributes->SetValue('disabled', 'disabled');
assuming you did choose disabled as attribute name.
That is all there is to it.
CCS 3.x + 4.x
To quick test, leave the condition out, just do the $Component->,,,,,,,, it will disable the button.
If not, you have wrong attribute name, or you are not in BeforeShow event of the Button.
To all: Attributes are power!
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
sosamv
Posts: 50
|
| Posted: 02/03/2009, 11:06 AM |
|
tha doesnt work for me
|
 |
 |
sosamv
Posts: 50
|
| Posted: 02/03/2009, 11:31 AM |
|
worked now hahaha sorry
|
 |
 |
|