i'm look for feedback for the proper way to make a link function as a button
this javascript automatically fills in the web and topic fields when you click on the "link"
this should do nothing if javascript is not enabled, and it should not cause a page refresh
WN
Index: templates/moveattachment.pattern.tmpl
===================================================================
--- templates/moveattachment.pattern.tmpl (revision 6313)
+++ templates/moveattachment.pattern.tmpl (working copy)
@@ -23,7 +23,7 @@
-%TMPL:DEF{"movewebhelp"}%To delete an attachment move it to web *%TRASHWEB%*, topic *TrashAttachment*.%TMPL:END%
+%TMPL:DEF{"movewebhelp"}%To <a href="void:" title="Move attachment to the Trash" onclick="javascript:document.forms.rename.newweb.value='Trash'; document.forms.rename.newtopic.value='TrashAttachment'; return false;">delete</a> an attachment, mov
e it to web *%TRASHWEB%*, topic *TrashAttachment*.%TMPL:END%
I think the link should call a js function instead of putting the form.name.button.name.value in the link.
To hide the link if javascript is off, we could make use of the css and javascript functions from
twisty
(TWiki::Plugins/TwistyContrib). The link should have the class
twikiTwistMakeVisible
, and then something like:
function init () {
makeVisibleElements = getElementsByClassName('twikiTwistMakeVisible');
i = makeVisibleElements.length;
while (i--)
{
removeClass(makeVisibleElements[i], 'twikiTwistMakeVisible');
}
}
--
AC
this implementation idea is superceeded by
Item553 --
WN