Drupal won't validate required field when disabled I have a content type with required field in it.
If the field is disabled then Drupal won't verify it. (it is being verified if not disabled).
How can I verify that the field has a value even if it's disabled?

More details:

For some of the users I set the value by Prepopulate and disable the field (by implementing the hook hook_form_alter).

I still want to prevent the user from messing with the URL.
For example: he can take the "new content" link I've created for him that looks like:

/node/add/my_type?edit[field_to_set]=12


and remove the URL query:

/node/add/my_type


I thought that if he would do it, he won't be able to save the form because of the required field (which is disabled) - but Drupal won't verify it.
According to the API docs of _form_builder_handle_input_element disabled fields are ignored, you can try using #access instead.

You can try adding your own handler after that of prepopulate and check if a (valid) value is entered, if not redirect the user or display a message

function MY_MODULE_form_alter(&amp;$form, $form_state, $form_id) {
  $form['#after_build'][] = 'MY_MODULE_prepopulate_after_build';
}

function MY_MODULE_prepopulate_after_build($form, &amp;$form_state) {
  // check #value
  if (empty($form['field_to_set'][0]['#value'])) {
    drupal_set_message ('You altered the URL', 'error');
    drupal_goto ();
  }
  // if #value is set, set #default_value as well
  if (empty($form['field_to_set']['und']['#default_value'])) {
    $form['field_to_set']['und']['#default_value'] = $form['field_to_set']['und']['#value']
  }
  return $form;
}