]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: Add check for empty FN field.
authorThomas Tanghus <thomas@tanghus.net>
Sat, 21 Apr 2012 18:36:17 +0000 (20:36 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Sat, 21 Apr 2012 22:44:53 +0000 (00:44 +0200)
apps/contacts/js/contacts.js

index 5f2bd6e9df9bbd0dccfdb40b9bdb4e69cb69baea..e5b34e241cbf8cc047a567f833245a20abaa6695 100644 (file)
@@ -1403,6 +1403,14 @@ $(document).ready(function(){
                Contacts.UI.Card.saveProperty(this);
        });
 
+       $('#fn').blur(function(){
+               if($('#fn').val() == '') {
+                       OC.dialogs.alert(t('contacts','The name field cannot be empty. Please enter a name for this contact.'), t('contacts','Name is empty'), function() { $('#fn').focus(); });
+                       $('#fn').focus();
+                       return false;
+               }
+       });
+       
        // Name has changed. Update it and reorder.
        $('#fn').live('change',function(){
                var name = $('#fn').val();