diff --git a/includes/webform.components.inc b/includes/webform.components.inc index d1de2f3..36cacce 100644 --- a/includes/webform.components.inc +++ b/includes/webform.components.inc @@ -378,7 +378,7 @@ function webform_component_edit_form(&$form_state, $node, $component, $clone = F '#type' => 'textfield', '#default_value' => empty($component['form_key']) ? _webform_safe_name($component['name']) : $component['form_key'], '#title' => t('Field Key'), - '#description' => t('Enter a machine readable key for this form element. May contain only alphanumeric characters and underscores. This key will be used as the name attribute of the form element. This value has no effect on the way data is saved, but may be helpful if doing custom form processing.'), + '#description' => t('Enter a machine readable key for this form element. Only lowercase letters and underscore are allowed as the first character. May contain only lowercase alphanumeric characters and underscores. This key will be used as the name attribute of the form element. This value has no effect on the way data is saved, but may be helpful if doing custom form processing.'), '#required' => TRUE, '#weight' => -9, ); @@ -603,8 +603,8 @@ function webform_component_edit_form(&$form_state, $node, $component, $clone = F function webform_component_edit_form_validate($form, &$form_state) { $node = node_load($form_state['values']['nid']); - if (!preg_match('/^[a-z0-9_]+$/i', $form_state['values']['form_key'])) { - form_set_error('form_key', t('The field key %field_key is invalid. Please include only lowercase alphanumeric characters and underscores.', array('%field_key' => $form_state['values']['form_key']))); + if (!preg_match('/^[_a-z]+[a-z0-9_]+$/i', $form_state['values']['form_key'])) { + form_set_error('form_key', t('The field key %field_key is invalid. Only lowercase letters and underscore are allowed as the first character. Please include only lowercase alphanumeric characters and underscores.', array('%field_key' => $form_state['values']['form_key']))); } foreach ($node->webform['components'] as $cid => $component) {