Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

validation error although the form is correct if number of steps is > 10 #1

Open
llenap opened this issue Feb 13, 2016 · 1 comment

Comments

@llenap
Copy link

llenap commented Feb 13, 2016

Hello,
I'm using your wizard sample which is great except for one thing: if I create more than 10 steps (11 steps for e.g.) and I create required field (let's say "fieldA") in step number 10, then I can't get pass 1st step. I get validation summary errors saying that the "field A is required". I went through the code but I just can't find the bug.
Can you please check?
Thanks a lot!
Yelena

@ghost
Copy link

ghost commented Jun 4, 2016

I think this is not going to help you, but...

If you look in the source code of 'WizardController' (https://github.com/LockTar/MVC.Wizard/blob/master/MVC.Wizard.Core/Controllers/WizardController.cs), in the function 'RemoveValidationRulesFromOtherSteps' you could see this:

foreach (var validationRuleFromOtherStep in ModelState.Where(m => !m.Key.StartsWith("Step" + (model.StepIndex))).ToList())

If you have a required field in step 10, this holds this condition (Step10 starts with Step1).

A solution is to change this line to:

foreach (var validationRuleFromOtherStep in ModelState.Where(m => !m.Key.StartsWith("Step" + (model.StepIndex) + "." )).ToList())

This makes different 'Step1' and 'Step10'.

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

No branches or pull requests

1 participant