Browse Source

分步表单验证成功后缓存用户输入数据

jqh 5 years ago
parent
commit
395a1d2f8d
2 changed files with 4 additions and 2 deletions
  1. 1 0
      resources/views/form/steps.blade.php
  2. 3 2
      src/Form/Concerns/HasSteps.php

+ 1 - 0
resources/views/form/steps.blade.php

@@ -114,6 +114,7 @@ LA.ready(function () {
         transitionEffect: 'fade',
         transitionEffect: 'fade',
         useURLhash: false,
         useURLhash: false,
         keyNavigation: false,
         keyNavigation: false,
+        showStepURLhash: false,
         lang: {
         lang: {
             next: '{{ trans('admin.next_step') }}',
             next: '{{ trans('admin.next_step') }}',
             previous: '{{ trans('admin.prev_step') }}'
             previous: '{{ trans('admin.prev_step') }}'

+ 3 - 2
src/Form/Concerns/HasSteps.php

@@ -32,8 +32,6 @@ trait HasSteps
             return;
             return;
         }
         }
 
 
-        $stepBuilder->stash($data);
-
         $steps = $stepBuilder->all();
         $steps = $stepBuilder->all();
 
 
         if ($this->isStepFormValidationRequest()) {
         if ($this->isStepFormValidationRequest()) {
@@ -81,6 +79,9 @@ trait HasSteps
             return $this->makeValidationErrorsResponse($validationMessages);
             return $this->makeValidationErrorsResponse($validationMessages);
         }
         }
 
 
+        // Stash input data.
+        $this->step()->stash($data);
+
         return $this->ajaxResponse('Success');
         return $this->ajaxResponse('Success');
     }
     }