Index: apachesolr.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.admin.inc,v
retrieving revision 1.1.2.31
diff -u -r1.1.2.31 apachesolr.admin.inc
--- apachesolr.admin.inc	23 Jul 2009 14:00:58 -0000	1.1.2.31
+++ apachesolr.admin.inc	7 Aug 2009 21:54:10 -0000
@@ -21,12 +21,14 @@
     '#title' => t('Solr host name'),
     '#default_value' => variable_get('apachesolr_host', 'localhost'),
     '#description' => t('Host name of your Solr server, e.g. <code>localhost</code> or <code>example.com</code>.'),
+    '#required' => TRUE,
   );
   $form['apachesolr_port'] = array(
     '#type' => 'textfield',
     '#title' => t('Solr port'),
     '#default_value' => variable_get('apachesolr_port', '8983'),
     '#description' => t('Port on which the Solr server listens. The Jetty example server is 8983, while Tomcat is 8080 by default.'),
+    '#required' => TRUE,
   );
   $form['apachesolr_path'] = array(
     '#type' => 'textfield',
@@ -91,6 +93,19 @@
 }
 
 /**
+ * Validation function for the apachesolr_settings form.
+ */
+function apachesolr_settings_validate($form, &$form_state) {
+  $port = $form_state['values']['apachesolr_port'];
+  $port_n = (int) $port;
+  // TODO: Port range should be 0-65535, but 0 lets apachesolr crash atm
+  if ($port != (string) $port_n || $port_n < 1 || $port_n > 65535) {
+    form_set_error('apachesolr_port',
+      t('The port has to be an integer between 1 and 65535!'));
+  }
+}
+
+/**
  * Gets information about the fields already in solr index.
  */
 function apachesolr_index_page() {
