Easy way to get this custom module to work with multiple Nodes (NID's) Topsitemaker hooked me up with this custom module that works great with one node when I enable it.  My issue is I need it to work across multiple nid's.  The field name and cid on all the nid's will stay the same, the only thing that will change will be the nid.  I have been trying without success to get this to work.  In this example it works for nid 4, but if the module is enabled, it will return the error for the same field on other nid's.  Is there an easy way to get this module to work with several nid's?

'&lt;?php

/**
 * Implements hook_form_alter().
 */
function sample_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // Make sure that we are selecting the webform forms.
  if (substr($form_id, 0, 20) == 'webform_client_form_') {
    $form['#validate'][] = 'sample_webform_validate';
  }
}

/**
 * Sample validation callback.
 */
function sample_webform_validate($form, &amp;$form_state) {
  // Replace this with the name of your field, cid (webform component ID) and
  // nid.
  $field_name = 'application_name_director_name_manager_name';
  $cid = 10;
  $nid = 4;
  // Check if this is a duplicate.
  $is_duplicate = db_select('webform_submitted_data', 'd')
    -&gt;fields('d')
    -&gt;condition('nid', $nid)
    -&gt;condition('cid', $cid)
    -&gt;condition('data', $form_state['values']['submitted'][$field_name])
    -&gt;execute()
    -&gt;fetchObject();
  if ($is_duplicate) {
    form_set_error($field_name, t('YOU HAVE ALREADY SUBMITTED FOR THAT APPLICATION, PLEASE SELECT A NEW APPLICATION.'));
  }
}

/**
 * Implements hook_form_alter().
 */
function sample_form_alter2(&amp;$form, &amp;$form_state, $form_id) {
  // Make sure that we are selecting the webform forms.
  if (substr($form_id, 0, 20) == 'webform_client_form_') {
    $form['#validate'][] = 'sample_webform_validate';
  }
}
Would have been good if you explained what the module does so we don't have to read through the code to understand the module.  

I am going to assume you mean the nid condition in the query.  

The condition function of the query object defaults to 'IN' if you send it an array.
eg.

$nid = array(4, 5, 6);


and then:  

-&gt;condition('nid', $nid)


will check nids 4, 5 and 6.
If you want to check all submitted webforms, just remove the nid condition.