I've some side effects using required fields within this
CheckableOption Field which is part of forum code.
$fs->push(new CheckableOption("EmailPublic", new EmailField('Email','Email *',"")),false);
$fs->push( new CheckableOption('CountryPublic',new TextField('Country','Country *'),true,true));
$fs->push(new PasswordField("Password", "Passwort *"));
...
$validator = new RequiredFields('Email','Password',...)
if i send the form without javascript (hack-test) and don't fill out Email, there's no response
under the field like 'you have to fill out Email' or so...
if i leave out Password anything is' fine.
same Problem with Country...
And some strange things happen also if javascript is enabled in the client.
the red error-text doesn't disappear sometimes, although there's entered text and the field was left by clicking in some other field.
i know that CheckableOption is not part of the core of ss.
But it feels to me, that there is something wrong with handling required fields...
i can hack in code, if someone could give me a hint where to search for...
fe: there's the code for
class CheckableOption extends CompositeField {
protected $childField, $checkbox;
function __construct($checkName, $childField, $value = "", $readonly = false) {
if( $readonly )
$this->checkbox = new CheckboxFieldDisabled($checkName, "", $value);
else
$this->checkbox = new CheckboxField($checkName, "", $value);
$this->childField = $childField;
$this->children = new FieldSet(
$this->childField,
$this->checkbox
);
}
function FieldHolder() {
return FormField::FieldHolder();
}
function Title() {
return $this->childField->Title();
}
function Field() {
return $this->childField->Field() . ' ' . $this->checkbox->Field();
}
}
no special thing done for required fields, so either the problem is deeper (CompositeElement)
or there has to be something more done in CheckableOption