Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arjan den Boer 76 posts 31 karma points
    Sep 25, 2009 @ 11:54
    Arjan den Boer
    0

    Add backend javascript file - i.e. Toggle checkbox list

    I've added a nice toggle function to the Checkbox list datatype by using pure javascript/jquery.

    I did this using this little jquery plugin and the following bit of jquery:

    jQuery(function($) {
     $(".propertyItemContent input[type=checkbox]:first").parents(".propertyItemContent table").after('<a style="cursor:pointer;margin:5px" onclick="$(this.parentNode).toggleCheckboxes()">toggle</a>');
    });

    I put this code in the same .js file as the plugin. You can find the resulting file here.

    Next I needed to add this js file to /umbraco/editContent.aspx. For this I can think of two options:

    • create a usercontrol that has nothing more in it then the js reference
    • add the js reference directly to /umbraco/editContent.aspx - hardcoded

    I did choose the second option because it does not need a usercontrol, but it is not upgrade-proof:

    ......
    <asp:Content ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="/umbraco_client/abcmedia/jquery.checkboxes.umb.js"></script>

    ......

    I'm wondering: is there a better, more safe option to add a javascript file to the backend?

Please Sign in or register to post replies

Write your reply to:

Draft