--- emfield.module.old	2008-05-23 14:49:14.000000000 -0400
+++ emfield.module	2008-06-06 14:23:11.000000000 -0400
@@ -114,7 +114,7 @@ function emfield_emfield_field($op, &$no
     case 'validate':
       foreach ($items as $delta => $item) {
         $error_field = $field['multiple'] ? $field['field_name'] .']['. $delta .'][embed' : $field['field_name'];
-        _emfield_field_validate_id($field, $item, $error_field, $module);
+        _emfield_field_validate_id($field, $item, $error_field, $module, $delta);
       }
       break;
 
@@ -260,9 +260,14 @@ function emfield_parse_embed($field, $em
 /**
  *  extract the id from embedded code or url
  */
-function _emfield_field_validate_id($field, $item, $error_field, $module) {
-  // does nothing at this time... TODO: fix this up
-  return _emfield_field_submit_id($field, $item, $module, $error_field);
+function _emfield_field_validate_id($field, $item, $error_field, $module, $delta = 0) {
+  // load the provider info
+  $item = _emfield_field_submit_id($field, $item, $module, $error_field);
+  // ensure we have proper provider info
+  if ($item['embed'] && !$item['value']) {
+    form_set_error($error_field, t('You have specified an invalid media URL or embed code.'));
+  }
+  return $item;
 }
 
 /**
@@ -538,7 +543,7 @@ function emfield_nodeapi(&$node, $op, $t
           // about here let extras change the data
           // allow modules (such as emthumb, or a future emmetadata) to alter our data.
           foreach (module_implements('emfield_field_extra') as $module) {
-            $args = array($op, &$node, $field, &$items, $teaser, $page, $module); 
+            $args = array($op, &$node, $field, &$items, $teaser, $page, $module);
             $ret = call_user_func_array($module .'_emfield_field_extra', $args);
             if (is_array($rss_encl) && is_array($ret)) {
               while (list($delta, ) = each($rss_encl)) {
@@ -609,14 +614,14 @@ function emfield_nodeapi(&$node, $op, $t
             $media['duration'] = (int) $file['duration'];
           }
           if (
-            isset($file['width']) && isset($file['height']) && 
+            isset($file['width']) && isset($file['height']) &&
             $file['width'] > 0 && $file['height'] > 0
           ) {
             $media['width'] = (int) $file['width'];
             $media['height'] = (int) $file['height'];
           }
           // media:lang will be interesting
-    
+
           $mrss_thumbnail = array();
           if (is_array($file['thumbnail']) && $file['thumbnail']['filepath'] != '') {
             $thumbnail = array();
@@ -738,7 +743,7 @@ function emfield_request_xml($provider, 
       if ($xml_elem['type'] == 'open') {
         if (array_key_exists('attributes', $xml_elem)) {
           list($level[$xml_elem['level']], $extra) = array_values($xml_elem['attributes']);
-        } 
+        }
   else {
           $level[$xml_elem['level']] = $xml_elem['tag'];
         }
