NIHVIVO-1603 Using jQuery in place of DWR to return the moniker selection experience to its former glory

This commit is contained in:
nac26 2011-02-06 01:44:24 +00:00
parent e56e4d89b4
commit 38f021251a
2 changed files with 28 additions and 5 deletions

View file

@ -331,4 +331,27 @@ function fillList(id, data, selectedtext) {
return [curleft,curtop]; return [curleft,curtop];
} }
--> -->
</script>
// -------------------------------------------------------------------------------
// Using jQuery to step in for DWR and provide original moniker selection behavior
// -------------------------------------------------------------------------------
var monikerSelection = {
// onChange event listener for moniker select list
monikerListener: function() {
$('#Moniker').change(function() {
// alert('The moniker has changed');
// if "[new moniker]" is selected, then enable the alt field
if ( $('#Moniker option:selected').text() == "[new moniker]" ) {
$('#MonikerSelectAlt').removeAttr('disabled');
} else {
$('#MonikerSelectAlt').val('');
$('#MonikerSelectAlt').attr('disabled', 'disabled');
}
});
}
}
$(document).ready(function() {
monikerSelection.monikerListener();
});
</script>

View file

@ -1,5 +1,5 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> <%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib prefix="form" uri="http://vitro.mannlib.cornell.edu/edit/tags" %> <%@ taglib prefix="form" uri="http://vitro.mannlib.cornell.edu/edit/tags" %>
<tr class="editformcell" id="entityNameTr"> <tr class="editformcell" id="entityNameTr">
@ -7,7 +7,7 @@
<b>Individual Name</b><br/> <b>Individual Name</b><br/>
<input style="width:80%;" type="text" name="Name" value="<form:value name="Name"/>" maxlength="255" /> <input style="width:80%;" type="text" name="Name" value="<form:value name="Name"/>" maxlength="255" />
<p class="error"><form:error name="Name"/></p> <p class="error"><form:error name="Name"/></p>
</td> </td>
</tr> </tr>
<tr class='editformcell' id='GenericTypeTr'> <tr class='editformcell' id='GenericTypeTr'>
@ -32,7 +32,7 @@
</td> </td>
<td id="newMonikerTd" valign="top">If [new moniker] is selected, enter here:<br/> <td id="newMonikerTd" valign="top">If [new moniker] is selected, enter here:<br/>
<input id="MonikerSelectAlt" name="Moniker" value="<form:value name="Moniker"/>"/> <input id="MonikerSelectAlt" name="Moniker" value="<form:value name="Moniker"/>" disabled="disabled" />
<i>otherwise leave this field blank</i> <i>otherwise leave this field blank</i>
</td> </td>
</tr> </tr>