Skip to content

Commit 364809a

Browse files
committed
checked field bug fixed
1 parent 7089ac8 commit 364809a

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Ajax/semantic/html/collections/form/HtmlForm.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,15 @@ private function addCompoValidation($js,$compo,$field){
169169
public function run(JsUtils $js) {
170170
$compo=NULL;
171171
foreach ($this->_fields as $field){
172-
$compo=$this->addCompoValidation($js, $compo, $field);
172+
if($field instanceof HtmlFormField)
173+
$compo=$this->addCompoValidation($js, $compo, $field);
173174
}
174175
foreach ($this->content as $field){
175176
if($field instanceof HtmlFormFields){
176177
$items=$field->getItems();
177178
foreach ($items as $_field){
178-
$compo=$this->addCompoValidation($js, $compo, $_field);
179+
if($_field instanceof HtmlFormField)
180+
$compo=$this->addCompoValidation($js, $compo, $_field);
179181
}
180182
}
181183
}

Ajax/semantic/html/collections/form/traits/CheckboxTrait.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function setType($checkboxType) {
1919
* @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox
2020
*/
2121
public function attachEvent($selector, $action=NULL) {
22-
return $this->getField()->attachEvent($selector, $action);
22+
return $this->getHtmlCk()->attachEvent($selector, $action);
2323
}
2424

2525
/**
@@ -28,10 +28,15 @@ public function attachEvent($selector, $action=NULL) {
2828
* @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox
2929
*/
3030
public function attachEvents($events=array()) {
31-
return $this->getField()->attachEvents($events);
31+
return $this->getHtmlCk()->attachEvents($events);
3232
}
3333

3434
public function getField(){
3535
return $this->content["field"]->getField();
3636
}
37+
38+
public function getHtmlCk(){
39+
return $this->content["field"];
40+
}
41+
3742
}

Ajax/semantic/html/elements/HtmlList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function addCheckedList($items=array(), $masterItem=NULL, $values=array()
8989
$identifier=$this->identifier . "-" . $count;
9090
if (isset($masterItem)) {
9191
$masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem);
92-
$masterO->getField()->addToProperty("class", "master");
92+
$masterO->getHtmlCk()->addToProperty("class", "master");
9393
$masterO->setClass("item");
9494
$this->addItem($masterO);
9595
}
@@ -98,7 +98,7 @@ public function addCheckedList($items=array(), $masterItem=NULL, $values=array()
9898
foreach ( $items as $val => $caption ) {
9999
$itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child");
100100
if (\array_search($val, $values) !== false) {
101-
$itemO->getField()->getField()->setProperty("checked", "");
101+
$itemO->getField()->setProperty("checked", "");
102102
}
103103
$itemO->setClass("item");
104104
$fields[]=$itemO;

0 commit comments

Comments
 (0)