[development] Forms API II: Return of the Chx (you really need to
read this)
Adrian Rossouw
adrian at bryght.com
Fri Aug 18 20:31:07 UTC 2006
On 8/18/06, Jeff Eaton <jeff at viapositiva.net> wrote:
>
>
> function mymodule_create_user() {
> // register a new user
> $form = drupal_retrieve_form('user_register');
> $form['#post']['edit']['name'] = 'robo-user';
> $form['#post']['edit']['mail'] = 'robouser at example.com'<%27robouser at example.com%27>
> ;
> $form['#post']['edit']['pass'] = 'password';
> drupal_process_form('user_register', $form);
>
This is awesome, but do we really need the '#post']['edit'] for every
element ?
for shorthand, couldn't we just do
$edit = drupal_retrieve_post('user_register');
$edit['name'] = 'robo-user';
$edit['mail'] = 'something';
$edit['pass'] = 'blah';
drupal_process_form('user_register', $edit);
You could have this as a wrapper of the functionality you mentioned above
even.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060818/627410d0/attachment.htm
More information about the development
mailing list