diff --git a/classes/class.field.php b/classes/class.field.php index 8692aea..18c8817 100755 --- a/classes/class.field.php +++ b/classes/class.field.php @@ -386,16 +386,29 @@ function getHTML($value = "") } elseif($this->type == "number") { - $r = 'id . '" name="' . $this->name . '" value="' . esc_attr($value) . '" '; if(!empty($this->size)) $r .= 'size="' . $this->size . '" '; if(!empty($this->class)) $r .= 'class="' . $this->class . '" '; if(!empty($this->readonly)) $r .= 'readonly="readonly" '; - if(!empty($this->html_attributes)) + if ( ! empty( $this->html_attributes ) ) { + // If custom values not available set the defaults + if ( ! array_key_exists( 'min', $this->html_attributes ) ) { + $this->html_attributes['min'] = '0'; + } + if ( ! array_key_exists( 'step', $this->html_attributes ) ) { + $this->html_attributes['step'] = '1'; + } $r .= $this->getHTMLAttributes(); - $r .= ' />'; + } else { + // Set the defaults + $this->html_attributes['min'] = '0'; + $this->html_attributes['step'] = '1'; + $r .= $this->getHTMLAttributes(); + } + $r .= ' />'; } elseif($this->type == "password") {