--- C:\Users\Ramesh\AppData\Local\Temp\node.inc-revBASE.svn000.tmp.inc	2010-07-14 11:14:40.000000000 +-0100
+++ Q:\nbc\kola_rnair\src\sites\all\modules\patterns\components\node.inc	2010-07-14 11:11:27.000000000 +-0100
@@ -92,12 +92,26 @@
 
       if ($id == 'node_delete_confirm') {
         $data['confirm'] = 1;
         return $data;
       }
 
+      // if input format set then fetch it's id
+      if (isset($data['format'])) {
+        $formats = filter_formats();
+        // if format given by name then replace with its id
+        if (!is_numeric($data['format'])) {
+          foreach ($formats as $id => $format) {
+            if ($data['format'] == $format->name) {
+              $data['format'] = $id;
+              break;              
+            }
+          }
+        }
+      }
+            
       $data['changed'] = time();
 
       $data['op'] = t('Save');
       $node = drupal_clone($data['node']);
 
       if (module_exists('content')) {
@@ -347,14 +361,32 @@
 
       return $data;
     break;
 
     // Validate the values for an action before running the pattern
     case 'validate':
-      // TODO: validate name field - should be valid/existing username
-
+
+      // check that block <format> is valid
+      if (isset($data['format'])) {
+        $formats = filter_formats();
+        // format specified by name?
+        if (!is_numeric($data['format'])) {
+          foreach ($formats as $id => $format) {
+            if ($data['format'] == $format->name)
+              return;
+          }
+          return t('Invalid input format name: %format', array('%format' => $data['format']));
+        } else {
+          if (!isset($formats[$data['format']])) {
+            return t('Invalid input format id: %format', array('%format' => $data['format']));
+          }
+        }
+      }
+    	
+      
+    	// TODO: validate name field - should be valid/existing username
       if (!node_get_types('types', $data['type'], TRUE) && !$data['delete']) {
         return t('Invalid content type: %type', array('%type' => $data['type']));
       }
     break;
 
     // Build a patterns actions and parameters
