NIHVIVO-194. Added a close button with click event listener to the custom form addNew div.

This commit is contained in:
rjy7 2010-04-04 04:48:41 +00:00
parent 52f45b2394
commit 1c3772a125
4 changed files with 39 additions and 7 deletions

View file

@ -87,6 +87,16 @@ option {
margin-bottom: 1.25em;
}
.close {
display: none; /* Hide if Javascript disabled. Javascript will show. */
#content form a.close {
float: right;
margin-right: 1em;
font-size: 90%;
}
#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

@ -135,7 +135,9 @@ var customForm = {
doAddFormStep1: function() {
if (this.formSteps == 1) {
customForm.addNewLink.css('margin-bottom', '1em');
customForm.doAddFormStep2();
customForm.doClose();
return;
}
@ -299,6 +301,7 @@ var customForm = {
hideFields: function(el) {
// Clear any input, so if we reshow the element the input won't still be there.
customForm.clearFields(el);
customForm.toggleRequiredHints('remove', el);
el.hide();
},
@ -325,14 +328,31 @@ var customForm = {
customForm.addNewLink.unbind('click');
customForm.addNewLink.bind('click', function() {
$(this).hide();
// Make sure to clear out what's in the existing select element,
// else it could be submitted even when hidden.
// RY When we have multiple existing and addNew divs, we won't
// show/hide them all, only the siblings of the addNewLink.
customForm.hideFields(customForm.existing);
customForm.showFields(customForm.addNew);
if (buttonText) {
customForm.button.val(buttonText);
}
return false;
});
},
doClose: function() {
// This can be bound once on page load, doesn't need to be unbound
// or rebound.
customForm.close.click(function() {
// RY When we have multiple existing and addNew divs, we won't
// show/hide them all, only the siblings of the addNewLink.
customForm.showFields(customForm.existing);
customForm.hideFields(customForm.addNew);
customForm.addNewLink.show();
return false;
});
},

View file

@ -381,8 +381,10 @@ core:organizationGrantingDegree (EducationalBackground : Organization) - no inve
</div>
<div class="new">
<a class="close" href="#">close</a>
<h6>Add a New Organization</h6>
<v:input type="text" label="Organization Name" labelClass="required" id="newOrgName" />
<v:input type="text" label="Organization Name" labelClass="required" id="newOrgName" size="30" />
<v:input type="select" label="Select Organization Type" labelClass="required" id="newOrgType" />
</div>
</div>

View file

@ -318,7 +318,7 @@
<div class="new">
<h6>Add a New Organization</h6>
<v:input type="text" label="Organization Name" labelClass="required" id="newOrgName" />
<v:input type="text" label="Organization Name" labelClass="required" id="newOrgName" size="30" />
<v:input type="select" label="Select Organization Type" labelClass="required" id="newOrgType" />
</div>
</div>