|
8 | 8 | use Ajax\semantic\html\collections\form\traits\TextFieldsTrait; |
9 | 9 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
10 | 10 | use Ajax\JsUtils; |
| 11 | +use Ajax\common\html\html5\HtmlInput as HtmlInput5; |
| 12 | +use Ajax\service\Javascript; |
11 | 13 |
|
12 | 14 | class HtmlInput extends HtmlSemDoubleElement { |
13 | 15 | use IconTrait,TextFieldsTrait,FieldTrait; |
14 | 16 |
|
15 | 17 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
16 | 18 | parent::__construct("div-" . $identifier, "div", "ui input"); |
17 | 19 | $this->_identifier=$identifier; |
18 | | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
| 20 | + $this->_libraryId=$identifier; |
| 21 | + $this->content=[ "field" => new HtmlInput5($identifier, $type, $value, $placeholder) ]; |
19 | 22 | $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
20 | 23 | $this->_variations=[ Variation::TRANSPARENT ]; |
21 | 24 | } |
@@ -44,4 +47,11 @@ public function run(JsUtils $js) { |
44 | 47 | public function setTransparent(){ |
45 | 48 | return $this->addToProperty("class", "transparent"); |
46 | 49 | } |
| 50 | + |
| 51 | + public function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL){ |
| 52 | + parent::compile_once($js,$view); |
| 53 | + if(isset($this->content['file'])){ |
| 54 | + $this->onCreate(Javascript::fileUploadBehavior($this->identifier)); |
| 55 | + } |
| 56 | + } |
47 | 57 | } |
0 commit comments