NIHVIVO-1774: js change to allow deletes when there is no first/last names

This commit is contained in:
tlw72 2011-01-17 22:04:07 +00:00
parent f3484f0331
commit 03db8dae59
2 changed files with 22 additions and 7 deletions

View file

@ -177,8 +177,9 @@ public class UserRetryController extends BaseEditController {
} }
else { else {
request.setAttribute("formOnSubmit", "return validateUserFields(this);"); request.setAttribute("formOnSubmit", "return validateUserFields(this);");
request.setAttribute("formOnCancel", "forceCancel(this.form);"); request.setAttribute("formOnCancel", "forceCancelTwo(this.form);");
} }
request.setAttribute("formJsp","/templates/edit/specific/user_retry.jsp"); request.setAttribute("formJsp","/templates/edit/specific/user_retry.jsp");
request.setAttribute("scripts","/templates/edit/specific/user_retry_head.jsp"); request.setAttribute("scripts","/templates/edit/specific/user_retry_head.jsp");
request.setAttribute("title","User Account Editing Form"); request.setAttribute("title","User Account Editing Form");

View file

@ -2,14 +2,24 @@
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
<!-- <!--
var bypassValidateUF = false;
function forceCancel(theForm) { // we don't want validation to stop us if we're canceling function forceCancel(theForm) { // we don't want validation to stop us if we're canceling
theForm.Md5password.value = "CANCEL"; // a dummy string to force validation to succeed theForm.Md5password.value = "CANCEL"; // a dummy string to force validation to succeed
theForm.passwordConfirmation.value = theForm.Md5password.value; theForm.passwordConfirmation.value = theForm.Md5password.value;
bypassValidateUF = true;
return true;
}
function forceCancelTwo(theForm) { // called when there are no password fields displayed
bypassValidateUF = true;
return true; return true;
} }
function validateUserFields(theForm) { function validateUserFields(theForm) {
if ( bypassValidateUF ) {
return true;
}
if (theForm.Username.value.length == 0 ) { if (theForm.Username.value.length == 0 ) {
alert("Please enter a valid Email address."); alert("Please enter a valid Email address.");
theForm.Username.focus(); theForm.Username.focus();
@ -32,11 +42,9 @@
function validatePw(theForm) { function validatePw(theForm) {
if ( theForm.Md5password.value != "CANCEL") {
if ( !validateUserFields(theForm) ) { if ( !validateUserFields(theForm) ) {
return false; return false;
} }
}
if (theForm.Md5password.value.length == 0 ) { if (theForm.Md5password.value.length == 0 ) {
alert("Please enter a password."); alert("Please enter a password.");
theForm.Md5password.focus(); theForm.Md5password.focus();
@ -58,8 +66,14 @@
} }
function confirmDelete() { function confirmDelete() {
bypassValidateUF = true;
var msg="Are you SURE you want to delete this user? If in doubt, CANCEL." var msg="Are you SURE you want to delete this user? If in doubt, CANCEL."
return confirm(msg); var answer = confirm(msg)
if ( answer )
return true;
else
bypassValidateUF = false;
return false;
} }
--> -->