Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: validation: "strict"does not work #1273

Closed
Sommerregen opened this issue Jan 26, 2017 · 4 comments
Closed

Bug: validation: "strict"does not work #1273

Sommerregen opened this issue Jan 26, 2017 · 4 comments
Assignees

Comments

@Sommerregen
Copy link
Contributor

Dear Grav Team,

I'm pretty sure this bug was introduced a while ago (when re-factoring the Blueprint classes). But today I noticed that validation: "strict" cannot be "switched on", i.e., $blueprint->validate() never throws an error even if you provide data that do not exists in the blueprint definition. MWE:

form:
  validation: strict

  fields:
    test:
      type: text
      label: "Test"

Then with PHP:

$blueprint = new Blueprint("blueprints://...");
$blueprint->validate(['wrong' => 'field']);
@rhukster
Copy link
Member

Passed this along to matias, as Forms/Blueprints are his speciality :)

@mahagr
Copy link
Member

mahagr commented Jan 14, 2020

Note that blueprints need to be loaded and initialized now:

$blueprint = new Blueprint($filename);
$blueprint->load()->init();
$blueprint->validate(['wrong' => 'field']);
``

@mahagr
Copy link
Member

mahagr commented Feb 18, 2020

@Sommerregen Unfortunately we have to revert this change from Grav 1.6 because of too many plugins and forms break because of the fix. :(

@mahagr
Copy link
Member

mahagr commented Feb 24, 2020

@Sommerregen We decided to put this feature under a configuration option as way too many forms stop working because of devtools added a bad configuration option which people forgot to remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants