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

method setup resets flag "submitted" to zero #15

Open
nicolasfranck opened this issue Jan 26, 2020 · 0 comments
Open

method setup resets flag "submitted" to zero #15

nicolasfranck opened this issue Jan 26, 2020 · 0 comments

Comments

@nicolasfranck
Copy link

When I run this code:

use strict;
use feature qw(:5.10);
use Data::MuForm;

my $form = Data::MuForm->new(
    field_list => [
        {
            type => "Text",
            required => 1,
            name => "name"
        }
    ]
);

$form->process(
    params => {},
    submitted => 1
);

say "errors: " . $form->has_errors();
say "validated: ". $form->validated();

it returns:

errors: 0
validated: 0

So it is both not valid, and has no errors: the situation when no validation has run yet.
After some code inspection I saw that the method setup resets the flag submitted
to 0 when the corresponding field value is not given:

https://github.com/gshank/data-muform/blob/master/lib/Data/MuForm.pm#L833

So validation is refused. But according to the documentation the flag submitted is used to force validation..
Wasn't that the way it worked in HTML::FormHandler?

Any idea?

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

No branches or pull requests

1 participant