Exemple #1
0
 public function __construct($name = 'number', $value = '0', $size = 20, $readonly = 'no', $allowempty = false)
 {
     parent::__construct($name, $value, $size, $readonly);
     $this->addOption('maxlength', $size);
     $this->addOption('style', 'text-align: right;');
     $this->addAction('onkeypress', ' var c = (window.event) ? event.keyCode : event.which;' . ' if(event.ctrlKey || c <= 31 || (c >= 48 && c <= 57)) return true; else return false; ');
     $this->addAction('onchange', ($allowempty ? ' if(this.value.length==0 || this.value==null) this.value = \'\'; else ' : '') . ' if(isNaN(parseInt(this.value,10))) this.value = 0; ' . ' else this.value = parseInt(this.value,10);');
 }
Exemple #2
0
 public function __construct($name = 'password', $value = '', $size = 20)
 {
     parent::__construct($name, $value, $size);
     $this->options['type'] = 'password';
 }