/** * File: LeftAndMain.AddForm.js */ (function($) { $.entwine('ss', function($){ /** * Class: .add-form * * Simple form with a page type dropdown * which creates a new page through .cms-edit-form and adds a new tree node. * * Requires: * ss.i18n * .cms-edit-form */ $('.add-form').entwine({ /** * Variable: Tree * (DOMElement) */ Tree: null, /** * Variable: OrigOptions * (Array) Map of ')); disableDropDown = false; } }); // Disable dropdown if no elements are selectable if (!disableDropDown) dropdown.removeAttr('disabled'); else dropdown.attr('disabled', 'disabled'); //Re-select the currently selected element if (selectedOption) dropdown.val(selectedOption); // Set default child (optional) if(selectedNode.hints && selectedNode.hints.defaultChild) { dropdown.val(selectedNode.hints.defaultChild); } // Set parent node (fallback to root) this.find(':input[name=ParentID]').val(selectedNode ? selectedNode.data('id') : 0); } }); }); }(jQuery));