I am creating some theme settings and am creating a form to populate them in theme-settings.php
. I am using the hook hook_form_system_theme_settings_alter()
.
I would like to restrict or verify that only numbers can be entered into a field. I've searched online but have not found how to do this. Would anyone know what I ought to add to my code?
Code currently looks like:
$form['mysite_theme']['mysite_contact_phone'] = array(
'#type' => 'textfield',
'#title' => t('Contact Number'),
'#default_value' => $default['mysite_contact_phone'],
'#description' => t('Enter the main contact number for this site.'),
'#required' => TRUE,
);