diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index d500673e41..d37b183910 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -63,7 +63,8 @@ define( } return dialogService.getUserInput( - wizard.getFormModel() + wizard.getFormModel(), + wizard.getInitialFormValue() ).then(persistResult, doNothing); } diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index 475a9ff8e0..8e072a3989 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -33,32 +33,53 @@ define( * show in the create dialog */ getFormModel: function () { - var parentRow = Object.create(parent), - sections = []; + var sections = []; sections.push({ name: "Properties", - rows: properties.map(function (property) { + rows: properties.map(function (property, index) { // Property definition is same as form row definition var row = Object.create(property.getDefinition()); - // But pull an initial value from the model - row.value = property.getValue(model); + + // Use index as the key into the formValue; + // this correlates to the indexing provided by + // getInitialFormValue + row.key = index; + return row; }) }); // Ensure there is always a "save in" section - parentRow.name = "Save In"; - parentRow.cssclass = "selector-list"; - parentRow.control = "_locator"; - parentRow.key = "createParent"; - sections.push({ label: 'Location', rows: [parentRow]}); + sections.push({ name: 'Location', rows: [{ + name: "Save In", + control: "locator", + key: "createParent" + }]}); return { sections: sections, name: "Create a New " + type.getName() }; }, + /** + * Get the initial value for the form being described. + * This will include the values for all properties described + * in the structure. + * + * @returns {object} the initial value of the form + */ + getInitialFormValue: function () { + // Start with initial values for properties + var formValue = properties.map(function (property) { + return property.getValue(model); + }); + + // Include the createParent + formValue.createParent = parent; + + return formValue; + }, /** * Based on a populated form, get the domain object which * should be used as a parent for the newly-created object. diff --git a/platform/core/bundle.json b/platform/core/bundle.json index 393fe40e6b..dcfbaaeb24 100644 --- a/platform/core/bundle.json +++ b/platform/core/bundle.json @@ -74,16 +74,16 @@ { "properties": [ { - "control": "_textfield", - "label": "Title", + "control": "textfield", + "name": "Title", "key": "name", "property": "name", "pattern": "\\S+", "required": true }, { - "control": "_checkbox", - "label": "Display title by default", + "control": "checkbox", + "name": "Display title by default", "key": "displayTitle", "property": [ "display", "title" ] }