7.3 H5表单元素

Drupal8龥龢html5龛龙龖龕龒龏龌龊龛龙龖龕龇龄龂齿齼buildForm齱齮齭龒齪齨龄齧齦齢齡齞

1齘齖齓齏齌(tel)

$form['phone'] = array(
    '#type' => 'tel',
    '#title' => t('Phone'),
);

2齘鼤鼡(email)

$form['email'] = array(
    '#type' => 'email',
    '#title' => t('Email'),
);

3齘鼚鼘(integer)

$form['integer'] = array(
    '#type' => 'number',
    '#title' => t('Some integer'),
    // The increment or decrement amount
    '#step' => 1,
    // Miminum allowed value
    '#min' => 0,
    // Maxmimum allowed value
    '#max' => 100,
);

4齘黹黸(date)

$form['date'] = array(
    '#type' => 'date',
    '#title' => t('Date'),
    '#date_date_format' => 'Y-m-d',
);

5齘黯黫URL(website)

$form['website'] = array(
    '#type' => 'url',
    '#title' => t('Website'),
);

6齘黡黠黟點鼘(search)

$form['search'] = array(
    '#type' => 'search',
    '#title' => t('Search'),
    '#autocomplete_route_name' => FALSE,
);

黙黖黕黒黫黏黍龊route_name龒黉黆黂黀麼麹麷黡黠齞

7齘麴麱(range)

$form['range'] = array(
    '#type' => 'range',
    '#title' => t('Range'),
    '#min' => 0,
    '#max' => 100,
    '#step' => 1,
);

本书共79小节:

评论 (写第一个评论)