Added "cancel" link to add new organization box on edit version of position history custom form. Previously had only been present on educational background form. Removed the link in non-Javascript version.

This commit is contained in:
rjy7 2010-04-15 19:34:26 +00:00
parent a5f9d133c0
commit d255909f3b
4 changed files with 17 additions and 9 deletions

View file

@ -100,7 +100,6 @@ option {
#content form a.close:link,
#content form a.close:visited {
/*display: none; Hide if Javascript disabled. Javascript will show. */
border-color: #FF7700;
color: #FF7700;
}

View file

@ -82,7 +82,6 @@ var customForm = {
this.returnViewField = $("input[name='view']");
this.cancel = this.form.find('.cancel');
this.close = this.form.find('.close');
// Read values used to control display
this.editType = $("input[name='editType']").val();
@ -94,7 +93,7 @@ var customForm = {
},
// On page load, make changes to the non-Javascript version for the Javascript version.
// These are features that will NOT CHANGE throughout the workflow of the Javascript version..
// These are features that will NOT CHANGE throughout the workflow of the Javascript version.
adjustForJs: function() {
var selectExistingLabel = $('.existing label');
@ -103,6 +102,17 @@ var customForm = {
this.existingOrNew.hide();
this.toggleRequiredHints('show', this.addNew);
// The close link in the addNew div closes the addNew div and restores the
// combined view. It is needed for the one-step add form and the edit form
// (which is a one-step form), but not for the two-step add form, since we'd
// want it to restore step 1, but the Cancel link at the bottom of the form
// already performs that function.
if (this.formSteps == 1) {
this.addNew.prepend('<a class="close" href="#">cancel</a>');
}
this.close = this.form.find('.close');
},
initForm: function() {
@ -337,8 +347,6 @@ var customForm = {
doClose: function() {
if (customForm.formSteps > 1) { return; }
customForm.close.unbind('click');
customForm.close.bind('click', function() {
// RY When we have multiple existing and addNew divs, we won't
@ -348,8 +356,9 @@ var customForm = {
customForm.addNewLink.show();
customForm.button.val(customForm.defaultButtonText);
customForm.doAddNewLinkForCombinedView();
customForm.setReturnView(customForm.views.COMBINED);
return false;
});
});
},
// Return true iff there are validation errors on the form

View file

@ -375,9 +375,7 @@ the org type still gets asserted. --%>
</div>
<div class="new">
<a class="close" href="#">cancel</a>
<h6>Add a New Organization</h6>
<v:input type="text" label="Organization Name ${requiredHint}" id="newOrgName" size="30" />
<v:input type="select" label="Select Organization Type ${requiredHint}" id="newOrgType" />
</div>

View file

@ -281,6 +281,7 @@
if (objectUri != null) { // editing existing entry
%>
<c:set var="editType" value="edit" />
<c:set var="formSteps" value="1" />
<c:set var="title" value="Edit position entry for ${subjectName}" />
<%-- NB This will be the button text when Javascript is disabled. --%>
<c:set var="submitLabel" value="Save changes" />
@ -288,6 +289,7 @@
} else { // adding new entry
%>
<c:set var="editType" value="add" />
<c:set var="formSteps" value="2" />
<c:set var="title" value="Create a new position entry for ${subjectName}" />
<%-- NB This will be the button text when Javascript is disabled. --%>
<c:set var="submitLabel" value="Create position" />
@ -343,7 +345,7 @@
<input type="hidden" name="secondaryType" value="organization" />
<%-- RY If set steps to 1 when editType == 'edit', may be able to combine the
step 1 and edit cases in the Javascript. --%>
<input type="hidden" name="steps" value="2" />
<input type="hidden" name="steps" value="${formSteps}" />
<input type="hidden" name="view" value="${view}" />
<p class="submit"><v:input type="submit" id="submit" value="${submitLabel}" cancel="${param.subjectUri}"/></p>