Index: USAGE.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/prepopulate/USAGE.txt,v retrieving revision 1.2 diff -u -r1.2 USAGE.txt --- USAGE.txt 12 Mar 2008 21:17:50 -0000 1.2 +++ USAGE.txt 7 Aug 2009 22:44:41 -0000 @@ -122,4 +122,17 @@ If I had first selected some text on the page, it would be put into the body of the node. + +POST Requests +------------- +Since Prepopulate uses the $_REQUEST variable, you have access to prepopulate +form values from either GET request in the URL, or the form POST requests. In +the below example, we prepopulate a node form's title based on a POST Request: +
+ + + Happy prepopulating! Index: prepopulate.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/prepopulate/prepopulate.module,v retrieving revision 1.10.2.2 diff -u -r1.10.2.2 prepopulate.module --- prepopulate.module 17 Nov 2008 18:02:36 -0000 1.10.2.2 +++ prepopulate.module 7 Aug 2009 22:44:41 -0000 @@ -16,7 +16,7 @@ function prepopulate_help($path, $arg) { switch ($path) { case 'admin/modules#description': - return t('Pre-populates forms with HTTP GET data'); + return t('Pre-populates forms with HTTP GET and POST data'); break; } } @@ -25,17 +25,17 @@ * Implementation of hook_form_alter(). */ function prepopulate_form_alter(&$form, $form_state, $form_id) { - if (isset($_GET['edit'])) { - foreach (array_keys((array)$_GET['edit']) as $getvar) { + if (isset($_REQUEST['edit'])) { + foreach (array_keys((array)$_REQUEST['edit']) as $getvar) { if (element_child($getvar) && !is_null($form[$getvar])) { - _prepopulate_get_walk($form[$getvar], $_GET['edit'][$getvar]); + _prepopulate_get_walk($form[$getvar], $_REQUEST['edit'][$getvar]); } } } } /** - * Internal helper to set element values from the $_GET variable. + * Internal helper to set element values from the $_REQUEST variable. * * @param &$form * Array. A form element. Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/prepopulate/README.txt,v retrieving revision 1.2 diff -u -r1.2 README.txt --- README.txt 12 Mar 2008 21:17:50 -0000 1.2 +++ README.txt 7 Aug 2009 22:44:41 -0000 @@ -8,7 +8,7 @@ Prepopulate is an attempt to solve the problem that resulted from the discussion at http://www.drupal.org/node/27155 where the $node object, it was (correctly, I believe) decided, should -not be prefilled from the $_GET variables, and instead, the power of the +not be prefilled from the $_REQUEST variable, and instead, the power of the FormsAPI should be used to modify the #default_value of the form elements themselves.