By Alvin Alexander. Last updated: June 3 2016
Drupal form textfield FAQ: What is the syntax to make a Drupal textfield required?
Just use the Drupal form #required property, like this:
$form['first_name'] = array( '#title' => t('First Name'), '#type' => 'textfield', '#required' => TRUE, );
In that example the Drupal form textfield is made required by setting the "#required" tag equal to TRUE.