mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: remove validation type constraint from form fields for 3.2 release
This commit is contained in:
parent
f275076908
commit
9e8a5c9ba5
@ -459,5 +459,4 @@ coding conventions. E.g. `DB::requireTable` is now `DB::require_table`
|
||||
* create_table_options now uses constants as API specific filters rather than strings.
|
||||
This is in order to promote better referencing of elements across the codebase.
|
||||
See `FulltextSearchable->enable` for example.
|
||||
* `FormField` subclasses must now use `validate(Validator $validator)` as the interface has changed for this function
|
||||
* `$FromEnd` iterator variable now available in templates.
|
||||
|
@ -318,7 +318,7 @@ class CheckboxSetField extends OptionsetField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$values = $this->value;
|
||||
if (!$values) {
|
||||
return true;
|
||||
|
@ -365,7 +365,7 @@ class CompositeField extends FormField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$valid = true;
|
||||
foreach($this->children as $idx => $child){
|
||||
$valid = ($child && $child->validate($validator) && $valid);
|
||||
|
@ -319,7 +319,7 @@ class ConfirmedPasswordField extends FormField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$name = $this->name;
|
||||
|
||||
// if field isn't visible, don't validate
|
||||
|
@ -58,7 +58,7 @@ class CreditCardField extends TextField {
|
||||
else return $this->value;
|
||||
}
|
||||
|
||||
public function validate(Validator $validator){
|
||||
public function validate($validator){
|
||||
if(!$this->value || !trim(implode("", $this->value))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class CurrencyField extends TextField {
|
||||
return $this->castedCopy('CurrencyField_Readonly');
|
||||
}
|
||||
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
if(!empty ($this->value)
|
||||
&& !preg_match('/^\s*(\-?\$?|\$\-?)?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?\s*$/', $this->value)) {
|
||||
|
||||
|
@ -336,7 +336,7 @@ class DateField extends TextField {
|
||||
/**
|
||||
* @return Boolean
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$valid = true;
|
||||
|
||||
// Don't validate empty fields
|
||||
|
@ -323,7 +323,7 @@ class DatetimeField extends FormField {
|
||||
}
|
||||
}
|
||||
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$dateValid = $this->dateField->validate($validator);
|
||||
$timeValid = $this->timeField->validate($validator);
|
||||
|
||||
|
@ -312,7 +312,7 @@ class DropdownField extends FormField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$source = $this->getSourceAsArray();
|
||||
if (!array_key_exists($this->value, $source)) {
|
||||
if ($this->getHasEmptyDefault() && !$this->value) {
|
||||
|
@ -30,7 +30,7 @@ class EmailField extends TextField {
|
||||
* @param Validator $validator
|
||||
* @return String
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$this->value = trim($this->value);
|
||||
|
||||
$pcrePattern = '^[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*'
|
||||
|
@ -181,7 +181,7 @@ class FileField extends FormField {
|
||||
return ($this->folderName !== false) ? $this->folderName : Config::inst()->get('Upload', 'uploads_folder');
|
||||
}
|
||||
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
if(!isset($_FILES[$this->name])) return true;
|
||||
|
||||
$tmpFile = $_FILES[$this->name];
|
||||
|
@ -922,7 +922,7 @@ class FormField extends RequestHandler {
|
||||
* @param Validator
|
||||
* @return boolean
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class GroupedDropdownField extends DropdownField {
|
||||
/**
|
||||
* @todo Implement DropdownField::validate() with group validation support
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ class ListboxField extends DropdownField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$values = $this->value;
|
||||
if (!$values) {
|
||||
return true;
|
||||
|
@ -125,7 +125,7 @@ class MemberDatetimeOptionsetField extends OptionsetField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$value = isset($_POST[$this->name . '_custom']) ? $_POST[$this->name . '_custom'] : null;
|
||||
if(!$value) return true; // no custom value, don't validate
|
||||
|
||||
|
@ -184,7 +184,7 @@ class MoneyField extends FormField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
return !(is_null($this->fieldAmount) || is_null($this->fieldCurrency));
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class NumericField extends TextField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
if(!$this->value) {
|
||||
return true;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ class PhoneNumberField extends FormField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator){
|
||||
public function validate($validator){
|
||||
$valid = preg_match(
|
||||
'/^[0-9\+\-\(\)\s\#]*$/',
|
||||
$this->joinPhoneNumber($this->value)
|
||||
|
@ -165,7 +165,7 @@ class TimeField extends TextField {
|
||||
* @param Validator $validator
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
|
||||
// Don't validate empty fields
|
||||
if(empty($this->value)) return true;
|
||||
|
@ -985,7 +985,7 @@ class UploadField extends FileField {
|
||||
* @param Validator $validator
|
||||
* @return boolean
|
||||
*/
|
||||
public function validate(Validator $validator) {
|
||||
public function validate($validator) {
|
||||
$name = $this->getName();
|
||||
$files = $this->getItems();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user