JS tweaks for form validation (file upload) and delete confirmation NIHVIVO-577

This commit is contained in:
nac26 2010-07-12 15:59:37 +00:00
parent 98ce002973
commit 8d5e7a2dc0
3 changed files with 19 additions and 26 deletions

View file

@ -1,27 +1,20 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
/* comments */
$(document).ready(function(){
$("#photoUploadContainer").removeClass("hidden");
$('#photoUploadForm form').submit(function() {
if (form_passed.datafile.value == "") {
alert ("Please browse and select a photo");
return false;
}
});
});
$("#photoUploadContainer").removeClass("hidden");
$('#photoUploadForm form').submit(function() {
if ($("#datafile").val() == '') {
alert('Please browse and select a photo.');
return false;
}
});
function delete_photo(passUrl) {
var delete_photo_answer = confirm ("Are you sure you want to delete your photo?");
if (delete_photo_answer){
window.open(passUrl);
}
}
$('a.delete').click(function(){
var answer = confirm('Are you sure you want to '+ jQuery(this).attr('title') +'?' );
// jQuery(this).attr('title') gets anchor title attribute
return answer;
});
});