作者:老葛,北京亚艾元软件有限责任公司,http://www.yaiyuan.com
按钮元素除了属性#executes_submit_callback默认为FALSE以外,其它属性与提交按钮元素完全相同。属性#executes_submit_callback告诉Drupal是否需要处理表单,为TRUE时处理表单,为FALSE时则简单的重新呈现表单。和提交按钮元素一样,可以将特定的验证和提交函数直接分配给这个按钮元素。
示例代码,来自(simpletest\tests\form_test.module):
$form['continue_button'] = array(
'#type' => 'button',
'#value' => 'Reset',
// Rebuilds the form without keeping the values.
);
常用属性: #access、 #after_build、 #ajax、 #attributes、 #button_type (默认为submit)、 #disabled、 #element_validate、 #executes_submit_callback ((默认为FALSE)、 #limit_validation_errors、 #name ((默认为op)、 #parents、 #post_render、 #prefix、#pre_render、#process、 #submit、 #states、 #suffix、 #theme、 #theme_wrappers、 #tree、 #type、 #validate、 #value、 #weight。