Skip to content

Commit cd7b92a

Browse files
committed
adds id for radios and checkeds
1 parent 073ff97 commit cd7b92a

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

Ajax/semantic/components/Dropdown.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@ public function setFullTextSearch($value){
3636
public function setShowOnFocus($value){
3737
return $this->setParam("showOnFocus", $value);
3838
}
39+
40+
public function setAllowAdditions($value){
41+
return $this->setParam("allowAdditions", $value);
42+
}
3943
}

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function setName($_name) {
104104
}
105105

106106

107-
public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) {
107+
public static function radios($identifier,$name, $items=array(), $label=NULL, $value=null, $type=NULL) {
108108
$fields=array ();
109109
$i=0;
110110
foreach ( $items as $val => $caption ) {
@@ -114,13 +114,13 @@ public static function radios($name, $items=array(), $label=NULL, $value=null, $
114114
}
115115
$fields[]=$itemO;
116116
}
117-
$radios=new HtmlFormFields("fields-".$name, $fields);
117+
$radios=new HtmlFormFields($identifier, $fields);
118118
if (isset($label))
119119
$radios->setLabel($label)->setProperty("for", $name);
120120
return $radios;
121121
}
122122

123-
public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) {
123+
public static function checkeds($identifier,$name, $items=array(), $label=NULL, $values=array(), $type=NULL) {
124124
$fields=array ();
125125
$i=0;
126126
foreach ( $items as $val => $caption ) {
@@ -131,7 +131,7 @@ public static function checkeds($name, $items=array(), $label=NULL, $values=arra
131131
}
132132
$fields[]=$itemO;
133133
}
134-
$radios=new HtmlFormFields("fields-".$name, $fields);
134+
$radios=new HtmlFormFields($identifier, $fields);
135135
if (isset($label))
136136
$radios->setLabel($label)->setProperty("for", $name);
137137
return $radios;
@@ -141,4 +141,9 @@ public function setEqualWidth($_equalWidth) {
141141
$this->_equalWidth=$_equalWidth;
142142
return $this;
143143
}
144+
145+
public function run(JsUtils $js){
146+
$result= parent::run($js);
147+
return $result->setItemSelector("[data-value]");
148+
}
144149
}

Ajax/semantic/html/modules/HtmlDropdown.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ public function setOn($on){
369369
public function setShowOnFocus($value){
370370
$this->_params["showOnFocus"]=$value;
371371
}
372+
373+
public function setAllowAdditions($value){
374+
$this->_params["allowAdditions"]=$value;
375+
}
372376

373377
public function setFullTextSearch($value){
374378
$this->_params["fullTextSearch"]=$value;

Ajax/semantic/traits/SemanticHtmlModulesTrait.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Ajax\semantic\html\modules\HtmlAccordion;
1818
use Ajax\semantic\html\collections\menus\HtmlAccordionMenu;
1919
use Ajax\semantic\html\modules\HtmlSticky;
20+
use Ajax\semantic\html\collections\form\HtmlFormFields;
2021

2122
trait SemanticHtmlModulesTrait {
2223

@@ -33,6 +34,18 @@ abstract public function addHtmlComponent(BaseHtml $htmlComponent);
3334
public function htmlCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) {
3435
return $this->addHtmlComponent(new HtmlCheckbox($identifier, $label, $value, $type));
3536
}
37+
38+
/**
39+
* @param string $identifier
40+
* @param array $items
41+
* @param string $label
42+
* @param mixed $value
43+
* @param string $type
44+
* @return HtmlFormFields
45+
*/
46+
public function htmlRadios($identifier, $items=[], $label=NULL,$value=NULL, $type=NULL) {
47+
return $this->addHtmlComponent(HtmlFormFields::radios($identifier,$items,$label,$value,$type));
48+
}
3649

3750
/**
3851
*

0 commit comments

Comments
 (0)