Commit 1b4698b4 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Pieforms: Check needsmultipart after running the element's set_attributes()

parent ab79429a
......@@ -322,15 +322,6 @@ class Pieform {/*{{{*/
$element['title'] = '';
}
// Force the form method to post if there is a file to upload
if (!empty($element['needsmultipart'])) {
$this->fileupload = true;
if ($this->data['method'] == 'get') {
$this->data['method'] = 'post';
self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'");
}
}
// This function can be defined by the application using Pieforms,
// and applies to all elements of this type
$function = 'pieform_element_' . $element['type'] . '_configure';
......@@ -350,6 +341,15 @@ class Pieform {/*{{{*/
$element = $function($element);
}
// Force the form method to post if there is a file to upload
if (!empty($element['needsmultipart'])) {
$this->fileupload = true;
if ($this->data['method'] == 'get') {
$this->data['method'] = 'post';
self::info("Your form '$this->name' had the method 'get' and also a file element - it has been converted to 'post'");
}
}
// Add the autofocus flag to the element if required
if (!$autofocusadded && $this->data['autofocus'] === true && empty($element['nofocus'])) {
$element['autofocus'] = true;
......
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