phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlInput.php
Go to the documentation of this file.
1<?php
3
7
9
10 protected $_placeholder;
11
12 public function __construct($identifier, $type = "text", $value = NULL, $placeholder = NULL) {
13 parent::__construct($identifier, "input");
14 $this->setProperty("name", $identifier);
15 $this->setValue($value);
16 $this->setPlaceholder($placeholder);
17 $this->setProperty("type", $type);
18 }
19
20 public function setValue($value) {
21 if (isset($value))
22 $this->setProperty("value", $value);
23 return $this;
24 }
25
26 public function setInputType($value) {
27 return $this->setProperty("type", $value);
28 }
29
30 public function forceValue($value = 'true') {
31 $this->wrap('<input type="hidden" value="false" name="' . $this->identifier . '"/>');
32 $this->setValue($value);
33 return $this;
34 }
35
36 public function setPlaceholder($value) {
37 if (JString::isNotNull($value))
38 $this->_placeholder = $value;
39 return $this;
40 }
41
42 public function compile(JsUtils $js = NULL, &$view = NULL) {
43 $value = $this->_placeholder;
44 if (JString::isNull($value)) {
45 if (JString::isNotNull($this->getProperty("name")))
46 $value = \ucfirst($this->getProperty("name"));
47 }
48 $this->setProperty("placeholder", $value);
49 return parent::compile($js, $view);
50 }
51}
JQuery PHP library.
Definition JsUtils.php:23
wrap($before, $after="")
Definition BaseHtml.php:170
__construct($identifier, $type="text", $value=NULL, $placeholder=NULL)
Definition HtmlInput.php:12
compile(JsUtils $js=NULL, &$view=NULL)
Definition HtmlInput.php:42