Error message
Notice: Undefined index: storage in biblio_node_form_next() (line 1600 of /Applications/MAMP/htdocs/d7bib/sites/all/modules/biblio/biblio.module).

and rightly so, $form['storage'] is not part of Drupal 7 anymore, see http://randyfay.com/node/66 and http://randyfay.com/node/74 which explains the form API changes from 6 to 7.

Comments

scor’s picture

Status: Active » Needs review
StatusFileSize
new2.57 KB
scor’s picture

usual self code review.

+++ biblio.module	22 Sep 2010 04:26:43 -0000
@@ -1214,14 +1214,13 @@ function biblio_form($node, $form_state)
-  $form['#cache'] = TRUE;

gone in D7

+++ biblio.module	22 Sep 2010 04:26:43 -0000
@@ -1214,14 +1214,13 @@ function biblio_form($node, $form_state)
-    );
-    $result = db_query('SELECT t.* FROM {biblio_types} as t WHERE tid > -2 AND visible = 1');
-    foreach ($result as $option) {
+  );
+  $result = db_query('SELECT t.* FROM {biblio_types} as t WHERE tid > -2 AND visible = 1');
+  foreach ($result as $option) {

indentation which was making the code logic confusing

+++ biblio.module	22 Sep 2010 04:26:43 -0000
@@ -1232,7 +1231,6 @@ function biblio_form($node, $form_state)
     '#attributes' => array('onchange' => 'document.getElementById(\'biblio-node-form\').submit()'),
-    '#submit' => array('biblio_node_form_next'),
     '#multiple' => FALSE,
     '#required' => TRUE
   );
@@ -1240,7 +1238,6 @@ function biblio_form($node, $form_state)

@@ -1240,7 +1238,6 @@ function biblio_form($node, $form_state)
   $form['biblio_next'] = array(
     '#type'   => 'submit',
     '#value'  => t('Next'),
-    '#submit' => array('biblio_node_form_next'),
   );

no need to repeat this since it's specified at the form level

+++ biblio.module	22 Sep 2010 04:26:43 -0000
@@ -1596,17 +1593,8 @@ function biblio_node_form_next($form, &$
     case t('Next'):
-      if ($form_state['storage']['biblio_type'] == $form_state['values']['biblio_type'] ||
-      (!empty($form['#node']->biblio_type) && $form['#node']->biblio_type == $form_state['values']['biblio_type']))
-      {
-        unset ($form_state['storage']);
-      }
-      else {
-        $form_state['storage']['biblio_type']  = $form_state['values']['biblio_type'];
-        $form_state['submitted'] = TRUE;
         $form_state['rebuild'] = TRUE;
         return;
-      }
   }

$form_state['storage'] does not exist in D7. I also believe $form_state['submitted'] is not necessary here.

Powered by Dreditor.

rjerome’s picture

I'm aware that there are still node form submission issues... I believe the biggest problem is that FAPI seems to have moved from "form" level to "element" level submission routines. I was playing a little JavaScript trick with "Type" selection box which would submit the form to change the type, but that depending on "form" level submission handling. I've got a few more ideas which I think should get this resolved today.

scor’s picture

StatusFileSize
new3.59 KB

I've written a couple of test cases for testing the node/add/biblio form and the node access control of biblio (which by the way lead to #919782: Permissions are duplicated and confusing). The attached test should be applied with the patch in #1 in order to work.

scor’s picture

StatusFileSize
new3.67 KB

The initial bug in this issue was fixed with http://drupal.org/cvs?commit=426190

reuploading a patch with tests.

scor’s picture

Status: Needs review » Closed (fixed)