phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlInput.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Ajax\bootstrap\html;
4 
6 use Ajax\JsUtils;
7 
14 
15  public function __construct($identifier) {
16  parent::__construct($identifier, "input");
17  $this->setProperty("name", $identifier);
18  $this->setProperty("class", "form-control");
19  $this->setProperty("role", "input");
20  $this->setProperty("value", "");
21  $this->setProperty("type", "text");
22  }
23 
24  public function setValue($value) {
25  $this->setProperty("value", $value);
26  }
27 
28  public function setInputType($value) {
29  $this->setProperty("type", $value);
30  }
31 
32  public function setLabel($label, $before=true) {
33  if ($before===true) {
34  $this->wrap("<label for='".$this->identifier."'>".$label."</label>", "");
35  } else {
36  $this->wrap("", "<label for='".$this->identifier."'>&nbsp;".$label."</label>");
37  }
38  }
39 
40  public function setPlaceHolder($value){
41  $this->setProperty("placeholder", $value);
42  }
43 
44  /*
45  * (non-PHPdoc)
46  * @see \Ajax\bootstrap\html\base\HtmlSingleElement::run()
47  */
48  public function run(JsUtils $js) {
49  $this->_bsComponent=$js->bootstrap()->generic("#".$this->identifier);
50  $this->addEventsOnRun($js);
51  return $this->_bsComponent;
52  }
53 
54  public function onChange($jsCode) {
55  return $this->addEvent("change", $jsCode);
56  }
57 
58  public function onKeypress($jsCode) {
59  return $this->addEvent("keypress", $jsCode);
60  }
61 }
Twitter Bootstrap simple Input component.
Definition: HtmlInput.php:13
setLabel($label, $before=true)
Definition: HtmlInput.php:32
addEventsOnRun(JsUtils $js=NULL)
wrap($before, $after="")
Definition: BaseHtml.php:171
bootstrap(Bootstrap $bootstrap=NULL)
getter or setter of the Twitter Bootstrap variable
Definition: JsUtils.php:141
JQuery PHP library.
Definition: JsUtils.php:23
addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false)