diff -Naur a//course/lib.php b//course/lib.php
--- a//course/lib.php	2010-10-30 16:32:11.866121607 -0400
+++ b//course/lib.php	2010-10-30 16:48:35.194178370 -0400
@@ -3700,6 +3700,28 @@
 }
 
 /**
+ * Checks whether a user is trying to submit a form with groups enabled
+ * but without defined groups in the course. Used as a callback by modform.
+ * @param integer $groupmode The group mode passed by modform
+ * @return boolean
+ */
+function course_form_check_groups($groupmode) {
+    global $CFG, $COURSE;
+    switch($groupmode) {
+        case VISIBLEGROUPS:
+        case SEPARATEGROUPS:
+            if(groups_get_all_groups($COURSE->id) !== false) {
+                return true;
+            } else return false;
+            break;
+        case NOGROUPS:
+        default:
+            return true;
+            break;
+    }           
+}
+
+/**
  * This class pertains to course requests and contains methods associated with
  * create, approving, and removing course requests.
  *
@@ -4022,4 +4044,4 @@
         $eventdata->smallmessage      = '';
         message_send($eventdata);
     }
-}
+}
\ No newline at end of file
diff -Naur a//course/moodleform_mod.php b//course/moodleform_mod.php
--- a//course/moodleform_mod.php	2010-10-30 16:32:24.422378647 -0400
+++ b//course/moodleform_mod.php	2010-10-30 16:48:44.734429847 -0400
@@ -395,6 +395,8 @@
                              VISIBLEGROUPS  => get_string('groupsvisible'));
             $mform->addElement('select', 'groupmode', get_string('groupmode', 'group'), $options, NOGROUPS);
             $mform->addHelpButton('groupmode', 'groupmode', 'group');
+            $mform->registerRule('groupsexist', 'callback', 'course_form_check_groups');
+            $mform->addRule('groupmode', get_string('nogroups','group'),'groupsexist');
         }
 
         if ($this->_features->groupings or $this->_features->groupmembersonly) {
