Permalink
Browse files

Use imageSubmit for OC and Category delete buttons.

On Firefox, at least, the image input button created by `/widgets/profile/button.mc` was causing subsequent calls to `form.submit()` to fail. For example, if you deleted a category and then hit the "Note" button, which calls `customSubmit()`, which calls `form.submit()`, the submit would fail. There would be no submit at all. I could not figure out why. Near as I can tell, hitting an image input and then not actually submitting causes the `form.submit()` DOM method to be disabled. But if you hit some other form method, it worked. NFI why.

So work around it by using an image submit link rather than input control. The functionality is the same, but does not break subsequent calls to `form.submit()` by other controls. I'm not altogether happy with this solution, but I can't see any other way around it without digging into the guts of Firefox, which I don't know at all.

Better, down the line, might be to alter the behavior of the Notes, Trail, Bulk Edit, and Diff/View buttons so that they don't do submits, but open a popover window or div. But that's a significan revision for another day (and wouldn't fix existing releases anyway, being new features).

So this will have to do.

[#281 state:closed]
  • Loading branch information...
1 parent 0d6c565 commit a4871783b9704bb93f7cd1a40e4c73ab61c48ddf @theory theory committed Dec 2, 2011
@@ -33,12 +33,11 @@
&>
</td>
<td class="action">
- <& '/widgets/profile/button.mc',
+ <&'/widgets/profile/imageSubmit.mc',
disp => $lang->maketext("Delete Output Channel"),
name => 'delete_oc',
value => $oc_id,
- button => 'delete_red',
- useTable => 0,
+ image => 'delete_red',
js => ($oc_id == $primary_oc_id ? qq{style="display: none" } : '') .
qq{onclick="ocListMan.remove(this.parentNode.parentNode); return false"}
&>
@@ -1,4 +1,5 @@
<%args>
+$disp => ''
$formName => 'theForm'
$callback => undef
$value => 1
@@ -12,10 +13,12 @@ $alt => ''
</%args>
<%init>;
my $localorno = $useGlobalImage ? '' : "$lang_key/";
+$disp = $lang->maketext($disp) if $disp;
$m->print(
qq{<a href="#" $js>},
qq{<img src="/media/images/$localorno$image.gif" },
qq{alt="$alt" },
+ qq{title="$disp" },
qq{style="vertical-align: middle; margin: ${vspace}px ${hspace}px;" /></a>},
($useHidden ? qq{<input type="hidden" name="$callback" value="" />} : ()),
);
@@ -33,14 +33,14 @@
&>
</td>
<td class="action">
- <& '/widgets/profile/button.mc',
+ <&'/widgets/profile/imageSubmit.mc',
disp => $lang->maketext("Delete Category"),
name => 'delete_category',
value => $cat_id,
- button => 'delete_red',
- useTable => 0,
+ image => 'delete_red',
js => ($cat_id == $primary_category_id ? qq{style="display: none" } : '') .
- qq{onclick="catListMan.remove(this.parentNode.parentNode); return false"}
+ qq{onclick="catListMan.remove(this.parentNode.parentNode); return false"},
+ useHidden => 0,
&>
</td>
</tr>
@@ -33,14 +33,14 @@
&>
</td>
<td class="action">
- <& '/widgets/profile/button.mc',
+ <&'/widgets/profile/imageSubmit.mc',
disp => $lang->maketext("Delete Output Channel"),
name => 'delete_oc',
value => $oc_id,
- button => 'delete_red',
- useTable => 0,
+ image => 'delete_red',
js => ($oc_id == $primary_oc_id ? qq{style="display: none" } : '') .
- qq{onclick="ocListMan.remove(this.parentNode.parentNode); return false"}
+ qq{onclick="ocListMan.remove(this.parentNode.parentNode); return false"},
+ useHidden => 0,
&>
</td>
</tr>

0 comments on commit a487178

Please sign in to comment.