drupal form 创建几种常见的类型(例子)
来源:互联网 发布:linux下svn命令 编辑:程序博客网 时间:2024/05/20 06:31
$form['id'] = array(
'#type' => 'hidden',
'#default_value' =>$id
);
$form['car_number'] = array(
'#title' => t('车牌号'),
'#type' => 'textfield',
'#default_value' =>$car_number,
'#required' => TRUE,
'#size' => 30,
'#weight' =>2
);
$form['barcode_image_current'] = array(
'#title' => t('图片'),
'#prefix' => l('<img class="barcode_image" src='.$barcode_image.'>',$barcode_image , array("html" => true)),
'#weight' => 3,
'#type' => 'hidden',
'#default_value' =>$id
);
$form['car_number'] = array(
'#title' => t('车牌号'),
'#type' => 'textfield',
'#default_value' =>$car_number,
'#required' => TRUE,
'#size' => 30,
'#weight' =>2
);
$form['barcode_image_current'] = array(
'#title' => t('图片'),
'#prefix' => l('<img class="barcode_image" src='.$barcode_image.'>',$barcode_image , array("html" => true)),
'#weight' => 3,
);
$form['barcode_image'] = array(
'#type' => 'file',
'#name'=>'barcode_image',
'#required' => false,
'#weight' =>4
);
$form['select'] = array(
);
$form['#validate'][] = 'test_form_validate';//调用验证函数
$form['submit'] = array(
'#title' => t('提交'),
'#type' => 'submit',
'#value'=>'提交',
'#weight' =>5
);
$form['access']['statistics_flush_accesslog_timer'] = array(
'#type' => 'select',
'#title' => t('Discard access logs older than'),
'#default_value' => variable_get('statistics_flush_accesslog_timer', 259200),
'#options' => $period,
'#description' => t('Older access log entries (including referrer statistics)
will be automatically discarded. (Requires a correctly configured
<a href="@cron">cron maintenance task</a>.)', array('@cron' =>
url('admin/reports/status'))),
);
function test_form_validate($form, &$form_state) {//
}
0 0
- drupal form 创建几种常见的类型(例子)
- Drupal $form的类型汇总
- 几种常见的RuntimeException例子
- 几种常见类型Cache的实现
- 几种常见类型的转换
- 常见软件的几种主要类型
- STL几种常见类型的比较
- 几种常见的shell类型
- 几种c++常见的类型转换
- 常见的几种事件类型
- 几种常见的DVD光盘类型
- 常见的几种异常类型Exception
- 几种常见的ICMP报文类型
- 创建bean的几种常见方法
- 几种常见的Observables创建方法
- vs创建的几种项目类型
- 几种常见设计模式的JAVA实现例子
- 【STL】String的几种常见的类型转换
- SOCKET编程之select
- NHibernate扩展方法(二) --查询分页
- AVAudioSession的一般使用
- ubuntu 12.04 时间面板乱码问题修正
- 修改文件、图片名称思路,比如要在名称后面加_2等
- drupal form 创建几种常见的类型(例子)
- uva 11324 The Largest Clique (强连通分量+dp)
- C# 流总结
- 安装Eclipse Maven插件的细节汇总
- hbase api
- C语言中的类型转换
- 字典树
- JQuery中$.ajax()方法参数详解
- ios--图片处理(修改、保存)UIGraphicsBeginImageContext