I've installed a fresh copy of drupal (7.10) and Data 7.x-1.0-alpha1.
I've enabled the Data module and then the Data UI module (after installing pre-requisite modules ctools and schema). Nothing else installed.

When I go to create a new data table I get an error message:

Notice: Undefined index: storage in data_ui_create_form() line 299

If I enter values in the fields to create the table and submit I then get these errors:

Notice: Undefined index: storage in data_ui_create_form() (line 299 of /var/www/vhosts/example.com/httpdocs/sites/all/modules/data/data_ui/data_ui.admin.inc).

Notice: Undefined index: storage in data_ui_create_form_validate() (line 344 of /var/www/vhosts/example.com/httpdocs/sites/all/modules/data/data_ui/data_ui.admin.inc).

Notice: Undefined index: storage in data_ui_create_form() (line 299 of /var/www/vhosts/example.com/httpdocs/sites/all/modules/data/data_ui/data_ui.admin.inc).

I have MySQL 5.0.77
PHP 5.3.3
Apache
(1and1 cloud server).

Pretty much stuck at the front door.. any help appreciated.

Comments

facal’s picture

Same problem for me on Drupal 7.9 and a bunch of other modules active.
MySQL: 5.1.56
PHP: 5.2.17
Apache

boabjohn’s picture

Same on 7.x-1.x-dev
PHP 5.2.6-1+lenny13
MySQL 5.0.51a
Apache2

RedTop’s picture

$form['storage'] is not part of Drupal 7 anymore.

Check for example:
http://drupal.org/node/918948

API docs
http://api.drupal.org/api/drupal/includes--form.inc/group/form_api/7

Unfortunately my PHP skills are non-existent so I can only supply some info. :(

joachim’s picture

This is useful reading: http://randyfay.com/node/66

I'll try to get onto this but if anyone wants to beat me to a patch that would be great -- please assign the issue to yourself to let everyone know you're working on it.

sanduciprian’s picture

i got the same problem

richard moger’s picture

+1.

In lieu of a fix I managed to get around this by going the other way. I created the table directly in the database within phpmyadmin, you can then use the adopt tab to register it (orphaned table) within data module.

I don't care where I create the table, I just need to export the schema from data into php so for my use case works fine.

Rich

sanduciprian’s picture

that works, but i got other problems, the edit item link doesn't work, and relationships in views, to display 2 tables in same view

joachim’s picture

Title: Undefined index: storage » 'Create new table' multistep form needs updating for D7: error "Undefined index: storage"
Version: 7.x-1.0-alpha1 » 7.x-1.x-dev

Updating issue title.

ViiNCENZO’s picture

+1

kanani’s picture

Assigned: Unassigned » kanani
kanani’s picture

Status: Active » Needs review
StatusFileSize
new8.24 KB

What started as some troubleshooting for the "data_ui_create_form" error ended up in a rewrite of the data_ui.admin.inc file.

After making the D7 changes for tracking the multistep form, I kept getting a "maximum nesting" level error.

Strangely changing the name of the form from data_ui_create_form <code/>to<code> data_ui_create_data_form fixed the issue.

I also added some labels to the form elements in _data_ui_field_form so that users could see what the different fields and checkboxes were for.

The new form is working locally but I'm unable to successfully test because of the call to db_escape_string in DataHandler.inc. See http://drupal.org/node/1419798

The patch updates data_ui.admin.inc as well as data_ui.module (because of the form name change).

SharonD214@aol.com’s picture

joachim’s picture

Status: Needs review » Needs work

> Strangely changing the name of the form from data_ui_create_form

to<code> data_ui_create_data_form fixed the issue. 

Weird! I wonder if there's an accidental hook clash there or something.

Patch looks good on an eyeball review, just a few things to tweak:

<code>
+++ b/data_ui/data_ui.admin.inc
@@ -291,12 +291,18 @@ function data_ui_adopt_form_submit($form, &$form_state) {
-/**
- * Form callback for create table form.
- */
-function data_ui_create_form($form, &$form_state) {

Can you either keep or rewrite the docblock? All functions need to have one.

+++ b/data_ui/data_ui.admin.inc
@@ -291,12 +291,18 @@ function data_ui_adopt_form_submit($form, &$form_state) {
+    // Display page 2 if $form_state['page_num'] == 2
...
+    // Otherwise we build page 1.
+    $form_state['page_num'] = 1;

Incorrect indentation (and more similar further on).

+++ b/data_ui/data_ui.admin.inc
@@ -316,35 +322,52 @@ function data_ui_create_form($form, &$form_state) {
+    // We won't bother validating the required 'color' field, since they

That comment looks like it's copied from Examples module! ;)

+++ b/data_ui/data_ui.module
@@ -92,11 +92,11 @@ function data_ui_menu() {
-  );
+  );  ¶

Watch out for whitespace changes.

dozymoe’s picture

The recursion has something to do with theme_data_ui_create_form() from line 905 below it, see need help to theme a form in drupal 7 [solved].

dozymoe’s picture

Status: Needs review » Needs work
StatusFileSize
new2.8 KB

Rewrote the patch a bit, also since data|contrib depends on ctools|contrib, might be better to use ctools multiform multi-step form instead.

Er, that's just a suggestion, it is not in the patch, dunno how yet.

dozymoe’s picture

Status: Needs work » Needs review

Set to need review.

joachim’s picture

Status: Needs work » Fixed

Thanks!
I added missing full stops at the end of one or two comments and added a couple of comments of my own, including this:

  // The table name is sanitized by the DataTable constructor.
  if (isset($form_state['storage']['name']) && data_get_table(trim($form_state['storage']['name']))) {

which I felt needed saying :)

- #1365346 by kanani, dozymoe: Fixed error messages in Create new table multistep form.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.