- Learn Drupal by example!
- Learn to develop custom Drupal modules and themes for 5.x, 6.x, 7.x and 8.x
- Post your questions and get solutions.
- Its free to join and post!
Drupal: Make single checkbox a required field
Primary tabs
This CodeLet will make a single checkbox a require field. This is usefule when you are creating a checkbox in your custom module.
CodeLet:
<?php
$form['terms_condition'] = array(
'#type' => 'checkboxes',
'#title' => t('Terms & condition'),
'#options' => array(
1 => t('I agree to Terms & condition'),
),
'#required' => TRUE,
);
?>
By DrupalD on Fri, 12/07/2013 - 7:49pm
Permalink
HTML code to copy to your site or email message:
HTML code to copy to your site or email message:
Click below to select, Ctrl + C to copy.
<a href="http://drupaldeveloper.in/node/28" title="drupaldeveloper.in, a Comprehensive Guide to Drupal Developers">Drupal: Make single checkbox a required field</a>
Add comment