1779 Posts in 582 Topics by 556 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 561 Views |
-
Custom validation

12 March 2011 at 8:22am
hi there,
My users can decide if they want receive money via paypal or banktransfer. There is a dropdownfield where users can choose
between this 2 options. Only if a user choose paypal I want to check if there is a paypal emailadresse and if it's correct (syntax).
And I only want to check if users filled out their bank data if they choosed banktransfer as payment type.So I subclassed TextField because I need a custom validation. But in my custom validation I also need the value(s) from other form fields, as described above.
In this schema ...
class PaypalEmailField extends TextField {
function validate($validator) {
...
}
}... I only have access to 1 formfield.
How to make all form fields accessable in the validator function?
To add the validation I use "new RequiredFields" ... but some fields are only required if other fields have special values
anybody dealed with this problematic yet?
thx
-
Re: Custom validation

12 March 2011 at 8:33am
this looks very promising
http://www.netefx.de/Silverstripe-NetefxValidator.php -
Re: Custom validation

12 March 2011 at 8:34am
I'd deal with this within the form action function before doing a redirect (or whatever action), or if in the CMS I'd use a custom validator for the data object being saved.
| 561 Views | ||
|
Page:
1
|
Go to Top |


