How to fire oncheckchanged event for language check boxes in sitecore publish form

158 Views Asked by At

We are working in Sitecore 7.1 version and we have multiple publishing targets and multiple languages.What we need to do is , when Chinese language is selected for any item at the time of publishing then publishing target for China (say Internet-China) should be selected automatically and when user select any other language then common publishing target for all other languages(say Internet) should be auto selected.

So Basically we need to fire oncheckchanged event for all languages appear in publishing form at the time of publish.

could anyone help us achieving this would be great. Thanks, Kapil

1

There are 1 best solutions below

1
Marek Musielak On BEST ANSWER

Check \sitecore\shell\Applications\Dialogs\Publish\Publish.js file. It already contains code to check or uncheck All Languages checkbox while clicking on particular language checkbox and the opposite way. You just need to add your code there.

I'm guessing you will need to hardcode a selector for Chinese language and for Internet-China target.


EDIT

Looks like the file I mentioned above was added in 7.2 version. You can create it on our own in 7.1. Just in Publish.xml add 2 scripts lines:

<WizardForm CodeBeside="Sitecore.Shell.Applications.Dialogs.Publish.PublishForm,Sitecore.Client">
  <Script Src="/sitecore/shell/Controls/Lib/jQuery/jQuery.noconflict.js"></Script>
  <Script Src="/sitecore/shell/Applications/Dialogs/Publish/Publish.js"></Script>

And create the mentioned publish.js file

jQuery(document).ready(function ($) {
    $('#Languages').find(':checkbox').click(function () {
        // if checkbox is checked and its value is Chinese id, select Internet-China target

        // if checkbox is checked and its value is not Chinese id, select Internet target
    });
});