diff options
author | xue <> | 2006-05-21 22:48:55 +0000 |
---|---|---|
committer | xue <> | 2006-05-21 22:48:55 +0000 |
commit | 2f02ab8fcbb5f45bb92cb9546c0328769c290049 (patch) | |
tree | bf8ce74d8fe37557b901ce486af5e41a938bdca9 /framework/Web/UI | |
parent | 28691ec3ccec6d94f7417987d8c7203bff3efecb (diff) |
Ensures control ID must start with a letter or underline character.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/TControl.php | 2 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TCheckBoxList.php | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 5becd7e6..66ac8fd5 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -73,7 +73,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable /**
* format of control ID
*/
- const ID_FORMAT='/^\\w*$/';
+ const ID_FORMAT='/^[a-zA-Z_]\\w*$/';
/**
* separator char between IDs in a UniqueID
*/
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php index de332897..2a16673c 100644 --- a/framework/Web/UI/WebControls/TCheckBoxList.php +++ b/framework/Web/UI/WebControls/TCheckBoxList.php @@ -62,7 +62,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont parent::__construct();
$this->_repeatedControl=$this->createRepeatedControl();
$this->_repeatedControl->setEnableViewState(false);
- $this->_repeatedControl->setID('0');
+ $this->_repeatedControl->setID('c0');
$this->getControls()->add($this->_repeatedControl);
}
@@ -282,7 +282,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $repeatedControl->getAttributes()->copyFrom($item->getAttributes());
else if($repeatedControl->getHasAttributes())
$repeatedControl->getAttributes()->clear();
- $repeatedControl->setID("$index");
+ $repeatedControl->setID("c$index");
$repeatedControl->setText($item->getText());
$repeatedControl->setChecked($item->getSelected());
$repeatedControl->setAttribute('value',$item->getValue());
@@ -301,7 +301,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont {
if($this->getEnabled(true))
{
- $index=(int)substr($key,strlen($this->getUniqueID())+1);
+ $index=(int)substr($key,strlen($this->getUniqueID())+2);
$this->ensureDataBound();
if($index>=0 && $index<$this->getItemCount())
{
@@ -353,7 +353,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $n=$this->getItemCount();
for($i=0;$i<$n;++$i)
{
- $this->_repeatedControl->setID("$i");
+ $this->_repeatedControl->setID("c$i");
$page->registerRequiresPostData($this->_repeatedControl);
}
}
@@ -381,7 +381,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont $this->setTabIndex($tabIndex);
}
}
-
+
/**
* Returns the value to be validated.
* This methid is required by IValidatable interface.
@@ -390,7 +390,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont public function getValidationPropertyValue()
{
return $this->getSelectedValue();
- }
+ }
}
?>
\ No newline at end of file |