/includes/form.inc

Description
Functions
dd_ajax_validate (line 357)

ajax 验证

___args settings

void dd_ajax_validate ( $uid,  $form_id,  $form_token, [ $clear = 1])
  • $uid
  • $form_id
  • $form_token
  • $clear
dd_del_form_cache (line 421)

删除表单缓存

void dd_del_form_cache ( $uid,  $form_id,  $form_token)
  • $uid
  • $form_id
  • $form_token
dd_form_ajax_all_check (line 1000)

全选

void dd_form_ajax_all_check ([(array) $att = NULL], [(string) $value = NULL])
  • (array) $att
  • (string) $value
dd_form_ajax_button (line 1038)

配合全选,通过 ajax 执行批量操作,rel 对应被选中对象的 class 属性

void dd_form_ajax_button ([(array) $att = NULL])
  • (array) $att
dd_form_ajax_check (line 1021)

配合全选按钮,class 对应全选按钮 alt 属性

void dd_form_ajax_check ([(array) $att = NULL])
  • (array) $att
dd_form_ajax_form (line 984)
void dd_form_ajax_form ( $url, [ $title = '确认提交'], [ $att = NULL])
  • $url
  • $title
  • $att
dd_form_button (line 1141)
void dd_form_button ( $field)
  • $field
dd_form_captcha (line 919)
void dd_form_captcha ( $field, [ $form = NULL])
  • $field
  • $form
dd_form_checkbox (line 958)

复选框字段

void dd_form_checkbox ( $field)
  • $field
dd_form_cmp (line 621)

字段按权重排序

void dd_form_cmp ( $a,  $b)
  • $a
  • $b
dd_form_error (line 852)
void dd_form_error ( $field)
  • $field
dd_form_field (line 636)

解析表单

void dd_form_field ( &$form,  $value, [ $error = array()])
  • &$form
  • $value
  • $error
dd_form_file (line 1136)
void dd_form_file ( $field)
  • $field
dd_form_hidden (line 878)
void dd_form_hidden ( $field)
  • $field
dd_form_html (line 542)

表单字段转换为 html

void dd_form_html ( $form,  $fields)
  • $form
  • $fields
dd_form_image (line 1151)
void dd_form_image ( $field)
  • $field
dd_form_inline (line 1238)
void dd_form_inline ( $form)
  • $form
dd_form_label (line 1155)
void dd_form_label ( $field)
  • $field
dd_form_password (line 903)
void dd_form_password ( $field)
  • $field
dd_form_radio (line 1087)

单选框字段

void dd_form_radio ((array) $field)
  • (array) $field
dd_form_required (line 428)

默认验证,验证表单合法性、必填字段

void dd_form_required ( $form,  $value)
  • $form
  • $value
dd_form_select (line 1059)

下拉框字段

void dd_form_select ((array) $field)
  • (array) $field
dd_form_selects (line 1071)
void dd_form_selects ( $field)
  • $field
dd_form_sort (line 590)
void dd_form_sort ( $fields)
  • $fields
dd_form_sort_child (line 606)
void dd_form_sort_child ( $fields)
  • $fields
dd_form_subfield (line 669)

多级

void dd_form_subfield ( &$form,  $field,  $value,  $error)
  • &$form
  • $field
  • $value
  • $error
dd_form_submit (line 1146)
void dd_form_submit ( $field)
  • $field
dd_form_textarea (line 908)
void dd_form_textarea ( $field)
  • $field
dd_form_textfield (line 859)
void dd_form_textfield ( $field)
  • $field
dd_form_weight (line 882)
void dd_form_weight ( $field)
  • $field
dd_get_error (line 713)
void dd_get_error ( $value,  $name)
  • $value
  • $name
dd_get_form (line 32)

调用一个表单

  • access: public
string dd_get_form (string $form_id)
  • string $form_id: 定义表单的函数
dd_get_form_cache (line 393)

获取表单缓存

void dd_get_form_cache ( $uid,  $form_id,  $form_token)
  • $uid
  • $form_id
  • $form_token
dd_get_form_meta (line 1259)

meta 表单字段,使用方法: $form['fields']['meta'] = dd_get_form_meta('asc', $value, array('title' => '页面标题');

  • return: 表单字段
(array) dd_get_form_meta ([(string) $sort = 'desc'], [(array) $value = array()], [(array) $title = array()])
  • (string) $sort: 字段组默认展开或闭合
  • (array) $value: 字段默认值
  • (array) $title: 字段标题,如:array('title' => '页面标题')
dd_get_value (line 695)
void dd_get_value ( $value,  $name)
  • $value
  • $name
dd_label (line 1242)
void dd_label ( $v, [ $class = NULL])
  • $v
  • $class
dd_set_form_cache (line 406)

生成表单缓存

void dd_set_form_cache ( $form)
  • $form
form_admin_search (line 1323)

便捷搜索表单

void form_admin_search ([string $name = 'keyword'], [array $form = array()], [string $title = ''])
  • string $name: 关键词字段名称
  • array $form: 可传入自定义字段
  • string $title: 输入字段显示名称
form_admin_search_validate (line 1352)
void form_admin_search_validate ( &$form,  &$value)
  • &$form
  • &$value
form_date_start_or_end (line 1371)

获取日期开始和结束字段

  • access: public
array|string form_date_start_or_end (string $title, [string $type = 'get'], [string $return = 'string'], [string $start = NULL], [string $end = NULL])
  • string $title: 字段名称
  • string $type: 表单 method,用于获取默认值
  • string $start: 默认开始日期,如:2010-12-24
  • string $end: 默认结束日期,如:2010-12-27
  • string $return: 需要返回的格式 array|string,前者可用于表单 $form,后者可直接输出到页面
form_get_type_info (line 234)

获取表单字段类型,可使用 hook_form_type_info() 来扩展字段类型,示例:

mymodule_form_type_info(&$types) { $types['mytype'] = array( 'name' => '我的自定义类型', 'callback' => 'mymodule_form_type_mytype', ); }

  • access: public
void form_get_type_info ()
form_save_submit (line 325)

提交按钮格式:

$form['submit'] = array( '#type' => 'submit', '#submit' => 'user_register_submit', '#value' => '确认注册' ); 表单内允许多个提交按钮,但仅会处理当前被提交项。 不论提交函数中的处理结果如何,均视为成功,并重定向。 表单重定向顺序: $_GET['redirect'] > $form['#redirect'] > $form['#action'] > $_GET['q']。 基于此,数据合法性等应在表单验证环节处理,提交环节只负责数据写入或删除。 可通过如下方式在提交函数中处理异常: 发现异常后重定向到某个页面,脱离默认表单处理流程。

void form_save_submit ( &$form,  &$value)
  • &$form
  • &$value
form_set_ahah (line 1181)
void form_set_ahah ([ $field = NULL])
  • $field
form_set_auto (line 1169)
void form_set_auto ([ $field = NULL])
  • $field
form_vali_mail (line 1220)

验证邮箱

void form_vali_mail ( $mail)
  • $mail
form_vali_mobile (line 1229)

验证手机号码

void form_vali_mobile ( $mobile)
  • $mobile
_dd_form_element (line 765)

解析字段

void _dd_form_element ( &$form,  $field,  $value,  $error)
  • &$form
  • $field
  • $value
  • $error
_dd_form_fieldset (line 736)
void _dd_form_fieldset ( $field,  $type)
  • $field
  • $type
_dd_form_html (line 569)
void _dd_form_html ( $fields)
  • $fields
_dd_form_required (line 484)
void _dd_form_required ( $form,  $field,  $value)
  • $form
  • $field
  • $value
_dd_form_required_subfield (line 462)
void _dd_form_required_subfield ( $form,  $field,  $value)
  • $form
  • $field
  • $value
_dd_form_weight (line 727)
void _dd_form_weight ( $form_id, [ $weight = 0])
  • $form_id
  • $weight
_form_save_submit (line 339)
void _form_save_submit ( $fields,  $subvalue,  &$value)
  • $fields
  • $subvalue
  • &$value

Documentation generated on Wed, 04 Jul 2012 14:35:57 +0800 by phpDocumentor 1.4.3