summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TBaseValidator.php
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2012-02-05 17:00:00 +0000
committerctrlaltca@gmail.com <>2012-02-05 17:00:00 +0000
commit4a8bd53f85b2dc0bcddd415873ce4ab49e1e099c (patch)
treec971ba1fcc4b414f2a4148b455ce249088cd5525 /framework/Web/UI/WebControls/TBaseValidator.php
parent871b91b471434aef56e421888bae1146dd74c990 (diff)
Make validators' FocusOnError play nice with TCheckBoxList and TRadioButtonList
Diffstat (limited to 'framework/Web/UI/WebControls/TBaseValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 6e4e8f71..30320c5f 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -416,7 +416,18 @@ abstract class TBaseValidator extends TLabel implements IValidator
public function getFocusElementID()
{
if(($id=$this->getViewState('FocusElementID',''))==='')
- $id=$this->getValidationTarget()->getClientID();
+ {
+ $target=$this->getValidationTarget();
+ /* Workaround: TCheckBoxList and TRadioButtonList nests the actual
+ * inputs inside a table; we ensure the first input gets focused
+ */
+ if($target instanceof TCheckBoxList && $target->getItemCount()>0)
+ {
+ $id=$target->getClientID().'_c0';
+ } else {
+ $id=$target->getClientID();
+ }
+ }
return $id;
}