Skip to content

Range validator problem #16

@H0w4rd

Description

@H0w4rd

I need to set a range validator on two dateinputs, so that date_from couldn't be newer than date_to.
This is how I expect that it should be:

$form['date_to']->addRule(Form::RANGE, "The date 'from' cannot be later than the date 'to'.", [$form['date_from'], null]);

but I'm receiving the following error:

Argument 1 passed to Vodacek\Forms\Controls\DateInput::normalizeDate() must be an instance of DateTime, instance of Vodacek\Forms\Controls\DateInput given, called in /data/src/interiors-remeslnici/vendor/voda/date-input/src/DateInput.php on line 138

So I had to write a server validation using onValidate[].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions