You are here

function clientside_validation_testswarm_html5 in Clientside Validation 7

Same name and namespace in other branches
  1. 7.2 clientside_validation_testswarm/clientside_validation_testswarm.forms.inc \clientside_validation_testswarm_html5()

Form callback for HTML5 elements

1 string reference to 'clientside_validation_testswarm_html5'
clientside_validation_testswarm_menu in clientside_validation_testswarm/clientside_validation_testswarm.module
Implements hook_menu().

File

clientside_validation_testswarm/clientside_validation_testswarm.forms.inc, line 106

Code

function clientside_validation_testswarm_html5($form, &$form_state) {
  $form['info'] = array(
    '#markup' => '<p><strong>' . t('Clientside Validation Testswarm - HTML5') . '</strong></p><p>' . t('For this test, the "Replace HTML5 validation with Clientside Validation" option must be set to "Yes"') . '</p>',
  );
  $form['mynumber'] = array(
    '#type' => 'numberfield',
    '#title' => t('HTML 5 number element'),
    '#description' => t('HTML 5 number element. Enter a number between 1.1 and 5.1 with steps of 1 (so: [1.1, 2.1, 3.1, 4.1, 5.1])'),
    '#min' => 1,
    '#max' => 5,
    '#step' => 0.5,
    '#required' => TRUE,
  );
  $form['myurl'] = array(
    '#type' => 'urlfield',
    '#title' => t('HTML 5 url element'),
    '#description' => t('HTML 5 url element. Enter a valid absolute url.'),
    '#required' => TRUE,
  );
  $form['myemail'] = array(
    '#type' => 'emailfield',
    '#title' => t('HTML 5 email element'),
    '#description' => t('HTML 5 email element. Enter a valid email.'),
    '#required' => TRUE,
  );
  $form['myrange'] = array(
    '#type' => 'rangefield',
    '#title' => t('HTML 5 range element'),
    '#description' => t('HTML 5 range element. Enter a number between 2 and 5 with steps of 0.5 (so:[2, 2.5, 3, 3.5, 4, 4.5, 5].'),
    '#min' => 2,
    '#max' => 5,
    '#step' => 0.5,
    '#required' => TRUE,
  );
  $form['mynumbermin'] = array(
    '#type' => 'numberfield',
    '#title' => t('Number min only'),
    '#description' => t('Number element. Minimum only'),
    '#min' => 2,
    '#step' => 'any',
    '#required' => TRUE,
  );
  $form['mynumbermax'] = array(
    '#type' => 'numberfield',
    '#title' => t('Number max only'),
    '#description' => t('Number element. Maximum only'),
    '#max' => 255,
    '#step' => 'any',
    '#required' => TRUE,
  );
  $form['mynumberminmax'] = array(
    '#type' => 'numberfield',
    '#title' => t('Number min and max'),
    '#description' => t('Number element. Minimum and maximum set'),
    '#min' => 2,
    '#max' => 255,
    '#step' => 'any',
    '#required' => TRUE,
  );
  $form['mynumberint'] = array(
    '#type' => 'numberfield',
    '#title' => t('Number integer'),
    '#description' => t('Number element. Integer only'),
    '#min' => 2,
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send'),
    '#weight' => 100,
  );
  return $form;
}