Skip to content

Commit d8452df

Browse files
committed
getDataField added
1 parent 848ec54 commit d8452df

File tree

7 files changed

+30
-7
lines changed

7 files changed

+30
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private function addCompoValidation($js,$compo,$field){
160160
if(isset($compo)===false){
161161
$compo=$js->semantic()->form("#".$this->identifier);
162162
}
163-
$validation->setIdentifier($field->getField()->getIdentifier());
163+
$validation->setIdentifier($field->getDataField()->getIdentifier());
164164
$compo->addFieldValidation($validation);
165165
}
166166
return $compo;

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public function getField(){
6060
return $this->content["field"];
6161
}
6262

63+
/**
64+
* Return the field with data
65+
* @return mixed
66+
*/
67+
public function getDataField(){
68+
return $this->content["field"];
69+
}
70+
6371
/**
6472
* puts the label before or behind
6573
*/
@@ -111,7 +119,7 @@ public function setReadonly(){
111119
}
112120

113121
public function addRule($type,$prompt=NULL,$value=NULL){
114-
$field=$this->getField();
122+
$field=$this->getDataField();
115123
if(isset($field)){
116124
if(!isset($this->_validation)){
117125
$this->_validation=new FieldValidation($field->getIdentifier());

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Ajax\semantic\html\collections\form;
44

5-
use Ajax\common\html\html5\HtmlInput;
65
use Ajax\semantic\html\collections\form\traits\TextFieldsTrait;
76
use Ajax\semantic\html\collections\form\traits\FieldTrait;
7+
use Ajax\semantic\html\elements\HtmlInput;
88

99
class HtmlFormInput extends HtmlFormField {
1010
use TextFieldsTrait,FieldTrait;
@@ -14,4 +14,11 @@ public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$p
1414
$placeholder=$label;
1515
parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label);
1616
}
17+
18+
public function getDataField(){
19+
$field= $this->getField();
20+
if($field instanceof HtmlInput)
21+
$field=$field->getField();
22+
return $field;
23+
}
1724
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@ public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NU
2222
public function setRows($count){
2323
$this->getField()->setRows($count);
2424
}
25+
26+
public function getDataField() {
27+
return $this->content["field"];
28+
}
2529
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function setTransparent() {
5656
}
5757

5858
public function setReadonly(){
59-
$this->getField()->setProperty("readonly", "");
59+
$this->getDataField()->setProperty("readonly", "");
6060
}
6161

6262
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
trait TextFieldsTrait {
66

7-
public abstract function getField();
7+
public abstract function getDataField();
88
public function setPlaceholder($value){
9-
$this->getField()->setPlaceholder($value);
9+
$this->getDataField()->setPlaceholder($value);
1010
return $this;
1111
}
1212

1313
public function setValue($value){
14-
$this->getField()->setValue($value);
14+
$this->getDataField()->setValue($value);
1515
return $this;
1616
}
1717
}

Ajax/semantic/html/elements/HtmlInput.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ public function getField() {
2222
return $this->content["field"];
2323
}
2424

25+
public function getDataField() {
26+
return $this->getField();
27+
}
28+
2529
public static function outline($identifier, $icon, $value="", $placeholder="") {
2630
$result=new HtmlInput($identifier, "text", $value, $placeholder);
2731
$result->addToProperty("class", "transparent");

0 commit comments

Comments
 (0)