Commit d0c2a843 authored by Nigel McNie's avatar Nigel McNie
Browse files

Only trash post data if the form has not yet been submitted, preventing loss...

Only trash post data if the form has not yet been submitted, preventing loss of form changes on a form error
parent 42ffff34
......@@ -247,14 +247,15 @@ class BlockInstance {
global $SESSION;
$SESSION->add_error_msg(get_string('errorprocessingform'));
}
// This is a bit hacky. Because pieforms will take values from
// $_POST before 'defaultvalue's of form elements, we need to nuke
// all of the post values for the form. The situation where this
// becomes relevant is when someone clicks the configure button for
// one block, then immediately configures another block
foreach (array_keys($elements) as $name) {
unset($_POST[$name]);
else {
// This is a bit hacky. Because pieforms will take values from
// $_POST before 'defaultvalue's of form elements, we need to nuke
// all of the post values for the form. The situation where this
// becomes relevant is when someone clicks the configure button for
// one block, then immediately configures another block
foreach (array_keys($elements) as $name) {
unset($_POST[$name]);
}
}
$content = $pieform->build(false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment