power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

Request: Do not issue a callback request if an ActiveControl is disabled #464

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi!

I want to use an TActiveLinkButton instead of a regular TLinkButton,
which, like the TLinkButton base control, should do nothing when Enabled is set 
to false.

Right now, the Enabled attribute is not honored and thus,
a callback is initiated anyways.

As a quick fix for my case, i modified 
TActiveLinkButton::addAttributesToRender() 
to not call $this->getActiveControl()->registerCallbackClientScript() if 
Enabled is
set to "false".

However, there might be a better/more generic solution to this problem which 
would
be available to all ActiveControls?

I see two ways to achieve that:
1. Do not render the client side JS if Enabled is set to false, or
2. do not issue the callback in activecontrols3.js when the sender has the 
(HTML) property disabled set?

Unfortunately, after quite some looking and debugging, I'm still not 
understanding 
the inner workings of the ActiveControls.

Maybe one of the more experienced Prado hackers could jump on on this?

Thanks,
Raoul

Original issue reported on code.google.com by ra...@bhatia.at on 30 May 2013 at 1:27

GoogleCodeExporter commented 8 years ago
Link buttons are rendered as <a> tags; an anchor doesn't follow the "disabled" 
attribute as <input> does (at least, not in a consistent cross-browser way).
Our "workaround" here is to set/remove the href attribute from the anchor. This 
special case was already implemented in TLinkButton but not in 
TActiveLinkButton.
It has been fixed in r3292

Original comment by ctrlal...@gmail.com on 31 May 2013 at 8:54