i want to create a webform , when i submit the new webform there is a error:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'nid' doesn't have a default value: INSERT INTO {webform} (confirmation, confirmation_format, redirect_url, status, block, allow_draft, auto_save, submit_notice, submit_text, submit_limit, submit_interval, total_submit_limit, total_submit_interval, progressbar_bar, progressbar_page_number, progressbar_percent, progressbar_pagebreak_labels, progressbar_include_confirmation, progressbar_label_first, progressbar_label_confirmation, preview, preview_next_button_label, preview_prev_button_label, preview_title, preview_message, preview_message_format, preview_excluded_components) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15, :db_insert_placeholder_16, :db_insert_placeholder_17, :db_insert_placeholder_18, :db_insert_placeholder_19, :db_insert_placeholder_20, :db_insert_placeholder_21, :db_insert_placeholder_22, :db_insert_placeholder_23, :db_insert_placeholder_24, :db_insert_placeholder_25, :db_insert_placeholder_26); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => <confirmation> [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => -1 [:db_insert_placeholder_10] => -1 [:db_insert_placeholder_11] => -1 [:db_insert_placeholder_12] => -1 [:db_insert_placeholder_13] => 1 [:db_insert_placeholder_14] => 0 [:db_insert_placeholder_15] => 0 [:db_insert_placeholder_16] => 1 [:db_insert_placeholder_17] => 1 [:db_insert_placeholder_18] => Start [:db_insert_placeholder_19] => Complete [:db_insert_placeholder_20] => 0 [:db_insert_placeholder_21] => [:db_insert_placeholder_22] => [:db_insert_placeholder_23] => [:db_insert_placeholder_24] => [:db_insert_placeholder_25] => [:db_insert_placeholder_26] => ) in drupal_write_record() (line 7166 of /drupal7/includes/common.inc).
CommentFileSizeAuthor
#4 webform-insert_nid-2119193-4.patch711 bytesgrahamC
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

谢艳’s picture

Status: Needs review » Active

I do not know exactly what's wrong, but I have solved this problem。
I guess the data structure in question, the installation is not fully installed, so i uninstall the module, clear the cache, reinstall ……problem solved

jaroslaw.kaminski’s picture

Hello.
I did what you said and it's not solved my problem :( I have same error on 7.x-4.0-beta1+4-dev

grahamC’s picture

I'm seeing this too in 7.x-4.x HEAD. I've traced it to the code in webform_node_insert():

 // Prepare the record for writing.
  $webform_record = $node->webform;
  $webform_record['preview_excluded_components'] = implode(',', $webform_record['preview_excluded_components']);

  // Insert the webform.
  $node->webform['nid'] = $node->nid;
  $node->webform['record_exists'] = (bool) drupal_write_record('webform', $webform_record);

So the $webform_record doesn't have an nid set when the record is being created.

grahamC’s picture

Issue summary: View changes
Priority: Normal » Major
Status: Active » Needs review
FileSize
711 bytes

Barely worth making a patch for, but here it is anyway.

ParisLiakos’s picture

Priority: Major » Critical
Status: Needs review » Reviewed & tested by the community
MXT’s picture

Patch provided in #4 works very well for me.

This is very CRITICAL: can this be committed ASAP?

Thank you very much

hswong3i’s picture

Confirm that patch from #4 works well, and I had now applied it to my drustack_webform.make ;-)

Thank you very much~~~

tripper54’s picture

+1 for #4 for me. Thanks!

kscheirer’s picture

Patch in #4 worked for me. Definitely critical, as the 4.x-dev branch is useless w/o being able to create new webforms.

rwilson0429’s picture

Agree, without the patch in #4, the 7.4.x-dev is useless in creating new webforms. Applying the #4 patch fixed it for me too. However, to get it to work I had to completely disable the webform module and uninstall it. After uninstall, ran update.php and flushed the caches. Downloaded the 7.x-4.x branch, applied the patch before enabling the module. It seems to work.

TwoD’s picture

Yep, #4 works great, and Webform is useless without it.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks guys, committed and this should be in the release tomorrow.

Status: Fixed » Closed (fixed)

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

fenstrat’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Closed (fixed) » Patch (to be ported)

Needs to be ported to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed 64eb545 to 8.x-4.x.

  • Commit fa69ec3 on 8.x-4.x authored by grahamC, committed by fenstrat:
    Issue #2119193 by grahamC | xieyanxy9: PDOException: SQLSTATE[HY000]:...

Status: Fixed » Closed (fixed)

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