Commit 97640213 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix unselect button for IE when js is off

parent 073b9475
...@@ -353,16 +353,18 @@ function pieform_element_filebrowser_get_value(Pieform $form, $element) { ...@@ -353,16 +353,18 @@ function pieform_element_filebrowser_get_value(Pieform $form, $element) {
// If we got to this point, the doupdate function couldn't select or unselect a file, // If we got to this point, the doupdate function couldn't select or unselect a file,
// so we need to let it go through to the form's submit function to deal with. // so we need to let it go through to the form's submit function to deal with.
if ($result['select']) { if (!empty($result['select'])) {
if ($element['config']['selectone']) { if ($element['config']['selectone']) {
$selected = array($result['select']); $selected = array($result['select']);
} }
else { else {
$selected = is_array($selected) ? $selected : array(); $selected = is_array($selected) ? $selected : array();
if (!in_array($result['select'], $selected)) {
$selected[] = $result['select']; $selected[] = $result['select'];
} }
} }
else if ($result['unselect']) { }
else if (!empty($result['unselect'])) {
$selected = is_array($selected) ? array_diff($selected, array($result['unselect'])) : array(); $selected = is_array($selected) ? array_diff($selected, array($result['unselect'])) : array();
} }
} }
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
</td> </td>
<td>{$file->description|escape}</td> <td>{$file->description|escape}</td>
<td> <td>
<noscript><button type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button></noscript> <button type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button>
<button type="button" class="button small unselect hidden" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button>
<input type="hidden" name="{$prefix}_selected[{$file->id}]" value="{$file->id}"> <input type="hidden" name="{$prefix}_selected[{$file->id}]" value="{$file->id}">
</td> </td>
</tr> </tr>
......
Supports Markdown
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