Form validation exempts #2506

merged 1 commit into from Feb 8, 2015


None yet
5 participants

chillu commented Oct 8, 2013

Followup from a 3.1 change by @kinglozzer which was limited to CMSForm rather than Form.
@halkyon @sminnee Do you think this is a good API to introduce on a Form level for 3.2?
See #2493 for context.


chillu commented Oct 8, 2013

The build is failing because of this here: silverstripe-labs/silverstripe-travis-support#1


halkyon commented Oct 8, 2013

I think this is a good idea, the multiform module already does something like this as well. e.g.

Sounds like it makes sense for this API on the Form class instead.


chillu commented Dec 20, 2013

I've rebased this against master, anybody keen to have a look?


kinglozzer commented Dec 20, 2013

@chillu Travis build is failing, looks like a regression from my original PR #2493 (not sure why it wasn’t picked up earlier). Looks like it’s getting stuck here:


The reasons for amending Form->buttonClicked() are in these two comments: silverstripe/silverstripe-cms#863 (comment) & silverstripe/silverstripe-cms#863 (comment). Essentially, Form->buttonClicked() wouldn’t include SiteTree’s actions, as it didn’t look inside CompositeField. The change was intended to flatten those fields.

Cause of failure:

The FileField test that’s failing doesn’t have any actions, so FieldList->dataFields() is returning null, hence the “Invalid argument supplied for foreach()”. FieldList->dataFields() calls FieldList->collateDataFields(), passing $sequentialSet as an argument by reference.

Because FieldList->sequentialSet is defined as null, and because there are no actions to be added to the list, it remains null and is returned as null.


Untested, but if we were to change protected $sequentialSet; to protected $sequentialSet = array(); in FieldList (and the same for $sequentialSaveableSet, plus amend FieldList->flushFieldsCache()) that should fix it I think.


edit: or you could just add that one line of PHP instead 😣

simonwelsh added the master label Mar 15, 2014

simonwelsh added this to the 3.2 alpha 1 milestone Mar 15, 2014


halkyon commented Sep 25, 2014

@chillu There's a bunch of whitespace being re-added in the commit. Could you clean that up please? :)

@dirx dirx added a commit to klitsche/silverstripe-framework that referenced this pull request Nov 4, 2014

@dirx dirx fixes Form buttonClick bug 8c22d24
@chillu chillu Form action validation excempts
Thanks to @kinglozzer for doing the majority of work on this. See #2493.

chillu commented Nov 26, 2014

Rebased against master, removed whitespace. @halkyon keen to merge?

@wilr wilr added a commit that referenced this pull request Feb 8, 2015

@wilr wilr Merge pull request #2506 from chillu/pulls/form-validation-exempt
Form validation exempts

@wilr wilr merged commit a4d4d02 into silverstripe:master Feb 8, 2015

0 of 2 checks passed

ci/scrutinizer Scrutinizer: 2 updated code elements — Tests: errored
continuous-integration/travis-ci The Travis CI build could not complete due to an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment