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小节:

评论 (写第一个评论)