|
List Info
Thread: Drupal 6.x FormAPI: validate and submit properties
|
|
| Drupal 6.x FormAPI: validate and submit
properties |
  United States |
2008-02-16 13:55:30 |
|
|
Hard at work trying to upgrade my modules to 6.x. Looked at the Drupal
5.x to 6.x FormAPI changes here: http://drupal.org/node/144132
Particularly this regarding the validate and submit properties: http://drupal.org/node/144132#custom-params
In Drupal 5.x, I've been using this format:
<?php
function og_user_roles_form_alter($form_id, &$form) {
$form['og_user_roles_regcode_gid']['og_user_roles_regcoderole_value_' . $gid] = array(
'#type' => 'select',
'#title' => t('Role to assign'),
'#options' => $roles,
'#default_value'
=> variable_get('og_user_roles_regcoderole_value_' . $gid, 0),
'#description' => t('Select
the role you wish to use as the "registration code group role" for
every new subscriber who subscribes to this group using one of the
registration codes above.'),
);
$form['#validate'] += array('og_user_roles_regcode_form_validate' => array($form_id, &$form));
$form['#submit'] += array('og_user_roles_regcode_form_submit' => array($form_id, &$form));
}
?>
My question is: How do I write the #validate and #submit properties for
the above in Drupal 6.x? My example above does not look like the ones
used here: http://drupal.org/node/144132#custom-params
So, would this be correct in Drupal 6.x?:
<?php
function og_user_roles_form_alter(&$form, &$form_state, $form_id) {
$form['og_user_roles_regcode_gid']['og_user_roles_regcoderole_value_' . $gid] = array(
'#type' => 'select',
'#title' => t('Role to assign'),
'#options' => $roles,
'#default_value'
=> variable_get('og_user_roles_regcoderole_value_' . $gid, 0),
'#description' => t('Select
the role you wish to use as the "registration code group role" for
every new subscriber who subscribes to this group using one of the
registration codes above.'),
);
$form['#validate'][] = 'og_user_roles_regcode_form_validate';
$form['#submit'][] = 'og_user_roles_regcode_form_submit';
}
?>
Thanks for any information provided.
-ron
--
Ron Parker
Software Creations http://www.scbbs.com
Self-Administration Web Site http://saw.scbbs.com
SDSS Subscription Mgmt Service http://sdss.scbbs.com
Central Ave Dance Ensemble http://www.centralavedance.com
R & B Salsa http://www.randbsalsa.com
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|