public function testSetValueArray() { $field = new DateSelectorField('Date'); $field->setValue(array('Day' => 2, 'Month' => 10, 'Year' => 2000)); $children = $field->getChildren(); $this->assertEquals('02', $children[0]->dataValue()); $this->assertEquals('10', $children[1]->dataValue()); $this->assertEquals('2000', $children[2]->dataValue()); $this->assertEquals('2000-10-02', $field->getValue()); }
/** * Return the form field * */ public function getFormField() { $field = DateSelectorField::create($this->Name, $this->Title); if ($this->Required) { // Required validation can conflict so add the Required validation messages // as input attributes $errorMessage = $this->getErrorMessage()->HTML(); $field->setAttribute('data-rule-required', 'true'); $field->setAttribute('data-msg-required', $errorMessage); } return $field; }