Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba


Go to End

23 Posts   6226 Views


Community Member, 83 Posts

25 March 2011 at 6:23am

We made a slight update of the documentation.
These rules have already been available in 0.4 , but they were not described in the documentation.

1) If you have textfields where you expect the user to enter a float number (e.g. 0.49) you would expect 0,49 in a german form.
So for validating values with decimal mark, you can give all numeric rules a second parameter, which specifies the expected decimal mark.

$rule_BedSize = new NetefxValidatorRule("BedSize", "SMALLEREQUAL", array('2.15',','), "We have no beds longer than 2,15 meters.");

2) for a CheckboxSetField you can validate min_number_checkboxes_checked and max_number_checkboxes_checked.
Check the section "FUNCTION rule: using library functions or writing own functions" in the documentation for an example usage.


Community Member, 83 Posts

28 July 2011 at 8:44pm

I just wanted to mention that there is a new version available for download.

new in 0.45: rule "checkboxes_no_overlapping"

This rule will just be needed in very rare situations i think.

you are managing a class "Party" in modeladmin.
A Party has the 2 relations to class Member.

public static $many_many      = array('VIP' => 'Member', '' => 'Exclusions' => 'Member');

So the administrator has to CheckboxSetFields, 1 for choosing the VIPs the other for those member who are definitely not allowed to join the party.

In this case you can define the validation rule:

$rule_excludedPersons_notVIP = new NetefxValidatorRule ("Exclusions", NV_FUNCTION, array('NetefxValidatorLibrary',
                                                                                                               array('field' => 'Exclusions',
                                                                                                                     'otherField' => 'VIP')),  "you selected people to be VIP and excluded them at the same time.");

As i said its an edge case.
But now this is also available.


Community Member, 83 Posts

21 September 2011 at 3:33am

Thanks to Zauberfisch, there is a completely rewritten version of the module available. (currently version 0.7)
The module can now be downloaded from github.

This version is no more compatible to 0.45 !
Also the documentation is outdated according to the changes in 0.7
We will change it as soon as possible.


Community Member, 83 Posts

29 September 2011 at 5:15am


Community Member, 7 Posts

17 November 2011 at 8:07pm

Edited: 17/11/2011 8:41pm

I'm having som trouble with this module. The validation works fine on the frontend of the app.
But when i try to access the records from the CMS it breaks with this error:

[14-Nov-2011 05:31:51] Error at sapphire/core/Object.php line 724: Uncaught Exception: Object->__call(): the method 'removevalidation' does not exist on 'NetefxValidator' (

Any ideas?

------ EDIT -----

Solved it by simply adding a removeValidation function in NetefxValidator.php

function removeValidation(){
    $this->rules = null;


Community Member, 7 Posts

23 November 2011 at 5:26am

Can you tell me how to get it to work in popups? Been trying for hours. Don't care if the values stays in the fields or not, just want it to work


Community Member, 83 Posts

23 November 2011 at 5:58am

Hi Jours,

you said "But when i try to access the records from the CMS it breaks with this error:"

I think you are managing your data by adding fields to function getCMSFields() of a page.
Afaik validation is not possible there.

Normally i manage everything in modeladmin. Modeladmin uses the function getCMSValidator() for validation. So
you can define all your validation rules in here.

Try to use the requiredFields validator from Silverstripe. (
If this works replace it with the NetefxValidator.


Community Member, 7 Posts

23 November 2011 at 7:28pm

Edited: 23/11/2011 8:31pm

So if i remove the call to getCMSFields() and add a call to getCMSValidator() with netefx it should work?

--- EDIT ---

actually, it worked without adding stuffs. To get the UNIQUE rule to work in the CTF popups i added this to the code:

if (isset($this->args[2]) && is_numeric($this->args[2])) {
    $id = $this->args[2];
} elseif(isset($_REQUEST['ctf']['childID'])){
    $id = $_REQUEST['ctf']['childID'];
} else {
    $idFieldInForm = (isset($this->args[2]))?$this->args[2]:'ID';
    $id = (isset($data[$idFieldInForm]))?Convert::raw2sql($data[$idFieldInForm]):false;

if you can put this in a future update it will work in the CTF popups aswell.