mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX #4306 simon_w: Fixed ConfirmedPasswordField::setValue()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@80192 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
547a9b700d
commit
6bcabcbe46
@ -88,7 +88,8 @@ class ConfirmedPasswordField extends FormField {
|
||||
// we have labels for the subfields
|
||||
$title = false;
|
||||
|
||||
parent::__construct($name, $title, $value, $form);
|
||||
parent::__construct($name, $title, null, $form);
|
||||
$this->setValue($value);
|
||||
}
|
||||
|
||||
function Field() {
|
||||
@ -193,6 +194,8 @@ class ConfirmedPasswordField extends FormField {
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
$this->children->fieldByName($this->Name() . '[_Password]')->setValue($this->value);
|
||||
$this->children->fieldByName($this->Name() . '[_ConfirmPassword]')->setValue($this->value);
|
||||
}
|
||||
|
||||
function jsValidation() {
|
||||
|
17
tests/forms/ConfirmedPasswordFieldTest.php
Normal file
17
tests/forms/ConfirmedPasswordFieldTest.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @package sapphire
|
||||
* @subpackage tests
|
||||
*/
|
||||
class ConfirmedPasswordFieldTest extends SapphireTest {
|
||||
function testSetValue() {
|
||||
$field = new ConfirmedPasswordField('Test', 'Testing', 'valueA');
|
||||
$this->assertEquals('valueA', $field->Value());
|
||||
$this->assertEquals('valueA', $field->children->fieldByName($field->Name() . '[_Password]')->Value());
|
||||
$this->assertEquals('valueA', $field->children->fieldByName($field->Name() . '[_ConfirmPassword]')->Value());
|
||||
$field->setValue('valueB');
|
||||
$this->assertEquals('valueB', $field->Value());
|
||||
$this->assertEquals('valueB', $field->children->fieldByName($field->Name() . '[_Password]')->Value());
|
||||
$this->assertEquals('valueB', $field->children->fieldByName($field->Name() . '[_ConfirmPassword]')->Value());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user