10375 Posts in 2190 Topics by 1707 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 282 Views |
-
Multiform Module 'Back' button form validation

5 September 2012 at 1:37pm
Hi, using the multiform module, when clicking on the "Back" button of a step (say step 2), it appears that the validation rules for this current step is fired.
Is this intended behaviour?
It would be only possible to do a "Back" if the current step validates, is there a way to hook the back button so as not to trigger validation?
-
Re: Multiform Module 'Back' button form validation

7 September 2012 at 10:11pm
Defiantly a bug! Raise it as an issue on the modules issue tracker (https://github.com/silverstripe/silverstripe-multiform/issues)
-
Re: Multiform Module 'Back' button form validation

12 September 2012 at 5:33am Last edited: 12 September 2012 6:11am
Hi Will,
tks for the reply.I am trying to see if I can debug that, perhaps you can help me a little.
I am looking at the MultiForm class's "actions_exempt_from_validation" feature, at approx. line 130:
if( $actionNames ) {
foreach( $actionNames as $exemptAction) {
if(!empty($_REQUEST[$exemptAction])) {
$applyValidation = false;
break;
}
}
}
It appears the code tries to check a match with exempted actions (e.g. action_prev) with the request object, but inspecting the $_REQUEST object only returns the multiformsessionid and not the posted action submit button!Then, I tried to inspect if the posted submit button is available via
$currentStep->loadData();
But this only returns the form fields' data, excluding the submit action.
I see no other location where the submit action is inspected in the code, does that mean I have to look into the Silverstripe base Form class?Also, I find it quite strange that the validation exemption is performed at __construct(), is it to exclude js validation code being injected? Shouldn't it be handled in httpSubmission() instead? Since we "do" want validation if, instead of hitting the "back", we hit the "next".
Does the __construct() here doubles as the handler for submission from the last form step?
If so, i find it more puzzling that the "current" step validation now depends on the posted action from the previous step
(the lines from 130 till "parent::__construct($controller, $name, $fields, $actions, $validator);")
| 282 Views | ||
|
Page:
1
|
Go to Top |


