CraueFormFlowBundle icon indicating copy to clipboard operation
CraueFormFlowBundle copied to clipboard

Take a step programmatically

Open sobocinski opened this issue 6 years ago • 1 comments

Hi, Is there any way to insert data and go to the second step automatically? I noticed that the isValid () method immediately save the form data to flow, but only when the request method is POST or PUT. In my case, I have divided the user registration form into two step, but when the user authorizes with Facebook I would like to go automatically to step two (geting data from Facebook works fine for me), and I able to go nextStep(), but without form validation:

$facebookUserRegister = $request->getSession()->get('_fb_login_form');
if($facebookUserRegister instanceof UserRegistration) {    
    $flow->bind($facebookUserRegister);    
    if ($flow->nextStep()) {           
         $flow->saveCurrentStepData($flow->createForm());
    }
}
else {
    $form = $submittedForm = $flow->createForm();
}

this solution does not meet my expectations. Is it possible to set the data manually and validate until the next stop?

sobocinski avatar Sep 03 '19 10:09 sobocinski

I did that in this commit https://github.com/Vigicorp/CraueFormFlowBundle/commit/f5aea0a8de9d5cce65beeb260f3f9c658e78ce0e

You just have to do this to defnie the default step $flow->setDefaultStepNumber(2);

I don't know if this is the best but i can make a PR.

PastisD avatar Jan 07 '20 14:01 PastisD