Version 0.9.5 beta - added attributes max, min, step, onblur, onfocus to the form.

This commit is contained in:
Stephan Kasdorf
2020-11-04 19:42:22 +01:00
parent 7b71fba0d5
commit 9070ec0dc8
4 changed files with 19 additions and 4 deletions

View File

@@ -65,6 +65,9 @@ class FormAttributes
$this->_element = str_replace(' action="ACTION"', '', $this->_element);
$this->_element = str_replace(' disabled="DISABLED"', '', $this->_element);
$this->_element = str_replace(' maxlength="MAXLENGTH"', '', $this->_element);
$this->_element = str_replace(' min="MIN"', '', $this->_element);
$this->_element = str_replace(' max="MAX"', '', $this->_element);
$this->_element = str_replace(' step="STEP"', '', $this->_element);
$this->_element = str_replace(' tabindex="TABINDEX"', '', $this->_element);
$this->_element = str_replace(' SPEECH', '', $this->_element);
$this->_element = str_replace(' FORM', '', $this->_element);
@@ -75,6 +78,8 @@ class FormAttributes
$this->_element = str_replace(' ', ' ', $this->_element);
$this->_element = str_replace(' type="TYPE"', '', $this->_element);
$this->_element = str_replace(' onchange="ONCHANGE"', '', $this->_element);
$this->_element = str_replace(' onblur="ONBLUR"', '', $this->_element);
$this->_element = str_replace(' onfocus="ONFOCUS"', '', $this->_element);
$this->_element = str_replace(' target="TARGET"', '', $this->_element);
$this->_element = str_replace(' method="METHOD"', '', $this->_element);
$this->_element = str_replace(' data-toggle="DATA-TOGGLE"', '', $this->_element);

View File

@@ -15,7 +15,10 @@ class TypeNumber extends FormAttributes implements IForm
self::FORM_NAME => '',
self::FORM_VALUE => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_CLASS => ''
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_MAX => '',
self::FORM_ATTRIBUTE_MIN => '',
self::FORM_ATTRIBUTE_STEP => ''
);
public function loadElement( $attributes )
@@ -31,7 +34,7 @@ class TypeNumber extends FormAttributes implements IForm
*/
private function _setElement( )
{
$this->_element = '<input type="number" name="NAME" value="VALUE" ID CLASS>' . "\n";
$this->_element = '<input type="number" name="NAME" value="VALUE" min="MIN" max="MAX" step="STEP" ID CLASS>' . "\n";
}

View File

@@ -15,7 +15,9 @@ class TypeSelect extends FormAttributes implements IForm
self::FORM_NAME => '',
self::FORM_ATTRIBUTE_CLASS => '',
self::FORM_ATTRIBUTE_ID => '',
self::FORM_ATTRIBUTE_ONCHANGE => ''
self::FORM_ATTRIBUTE_ONCHANGE => '',
self::FORM_ATTRIBUTE_ONBLUR => '',
self::FORM_ATTRIBUTE_ONFOCUS => ''
);
public function loadElement( $attributes )
@@ -31,6 +33,6 @@ class TypeSelect extends FormAttributes implements IForm
*/
private function _setElement( )
{
$this->_element = '<select name="NAME" onchange="ONCHANGE" ID CLASS SELECTED>' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
$this->_element = '<select name="NAME" onchange="ONCHANGE" onblur="ONBLUR" onfocus="ONFOCUS" ID CLASS SELECTED>' . "\n" . 'OPTIONS' . "\n" . '</select>' . "\n";
}
}

View File

@@ -25,6 +25,9 @@ interface IForm
const FORM_TYPE_BUTTON = 'button';
const FORM_ATTRIBUTE_ROWS = 'rows';
const FORM_ATTRIBUTE_COLS = 'cols';
const FORM_ATTRIBUTE_MIN = 'min';
const FORM_ATTRIBUTE_MAX = 'max';
const FORM_ATTRIBUTE_STEP = 'step';
const FORM_ATTRIBUTE_SPEECH = 'speech';
const FORM_ATTRIBUTE_SRC = 'src';
const FORM_ATTRIBUTE_ALT = 'alt';
@@ -37,6 +40,8 @@ interface IForm
const FORM_ATTRIBUTE_TYPE = 'type';
const FORM_ATTRIBUTE_ONCHANGE = 'onchange';
const FORM_ATTRIBUTE_ONSUBMIT = 'onsubmit';
const FORM_ATTRIBUTE_ONBLUR = 'onblur';
const FORM_ATTRIBUTE_ONFOCUS = 'onfocus';
const FORM_ATTRIBUTE_SELECTED = 'selected';
const FORM_ATTRIBUTE_CONTEXT = 'context';
const FORM_ATTRIBUTE_CHECKED = 'checked';