public function testSetValue() { $field = new InputField('field1', 'field1'); $field->setValue('test'); $this->assertEquals($field->getValue(), 'test'); $field->setValue(null); $this->assertNull($field->getValue()); }
public function render(InputField $field) { $minAttr = $this->min !== null ? ' min="' . $this->min . '"' : null; $maxAttr = $this->max !== null ? ' max="' . $this->max . '"' : null; $stepAttr = $this->step !== null ? ' step="' . $this->step . '"' : null; return '<input type="number" name="' . $field->getName() . '" id="' . $field->getName() . '" value="' . htmlspecialchars($field->getValue()) . '"' . $minAttr . $maxAttr . $stepAttr . '>'; }
public function render(InputField $field) { $required = null; if ($field->hasRule('ch\\metanet\\formHandler\\rule\\RequiredRule')) { $required = ' aria-required="true"'; } return '<input type="email" name="' . $field->getFormIdentifierAsString() . '" id="' . $field->getId() . '" value="' . htmlspecialchars($field->getValue()) . '"' . $this->getAttributesAsHtml() . $required . '>'; }
public function render(InputField $field) { return '<input type="password" name="' . $field->getName() . '" id="' . $field->getName() . '" value="' . $field->getValue() . '">'; }
public function render(InputField $field) { return '<textarea name="' . $field->getName() . '" id="' . $field->getName() . '"' . $this->getAttributesAsHtml() . '>' . htmlspecialchars($field->getValue()) . '</textarea>'; }