This is my first time posting an issue so please forgive me if I've done it wrong.

I have created a 'test site' using Drupal 8 in order to test its suitability for a major upcoming project. My company uses the Webforms module routinely so I went ahead and installed it (version 8.x-4.x-dev) on my test site.

The installation of the Webform module went fine and I could immediately access the webform in my "content types" menu.

Then, I added a text field with a "name" label. I went back to see how this looked, and could not see the field showing on my webform at all.
I decided to try to add another field to see if that worked, so I added an "Email field". All was well until the final "Save" (while adding this field) after which I was redirected to a white page reading "The website encountered an unexpected error. Please try again later".

I had a colleague do the same to make sure it wasn't just user error, and he had the same result.

I've attached a screenshot of the error for your reference.

Please advice me if I should go about reporting this differently, and thank you for your time. :)

Comments

RazmatazMcGrav created an issue. See original summary.

heneryh’s picture

Me too. Created the form, added name. Added email but that threw one error. Now the whole web site is bonked with

Fatal error: Call to undefined function url() in /Users/Joe/Sites/devdesktop/henriques-dev/docroot/modules/webform/webform.module on line 1847

sureshcj’s picture

Me to got a same error. Kindly provide any solution for this issue.

I got error log message like :

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1364 Field 'value' doesn't have a default value: INSERT INTO {webform_component} (nid, cid, type, pid, weight, name, form_key, required, extra) 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); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 3 [:db_insert_placeholder_2] => email [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 2 [:db_insert_placeholder_5] => Name1 [:db_insert_placeholder_6] => name1 [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => a:2:{s:11:"wrapper_css";s:6:"sdfsdf";s:9:"field_css";s:6:"sfdsdf";} ) in Drupal\webform\ComponentBase->save() (line 274 of /var/www/html/xxx/modules/webform/src/ComponentBase.php).

manasiv’s picture

API change reference:
Use the \Drupal\Core\Url object in place of arrays of route info - https://www.drupal.org/node/2189619
l() and url() are removed in favor of a routing based URL generation API - https://www.drupal.org/node/2346779

ironkiat’s picture

When the error happens, check your PHP log and you should see something like this:

" at /Users/Kiat/Sites/drupal/core/lib/Drupal/Core/Database/Connection.php line 676
[24-Feb-2016 03:34:20 Asia/Singapore] Uncaught PHP Exception Drupal\Core\Database\DatabaseExceptionWrapper: "SQLSTATE[HY000]: General error: 1364 Field 'value' doesn't have a default value: INSERT INTO {webform_component} (nid, cid, type, pid, weight, name, form_key, required, extra) 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); Array
(
    [:db_insert_placeholder_0] => 2
    [:db_insert_placeholder_1] => 2
    [:db_insert_placeholder_2] => number
    [:db_insert_placeholder_3] => 0
    [:db_insert_placeholder_4] => 1
    [:db_insert_placeholder_5] => num
    [:db_insert_placeholder_6] => num
    [:db_insert_placeholder_7] => 0
    [:db_insert_placeholder_8] => a:2:{s:11:"wrapper_css";s:0:"";s:9:"field_css";s:0:"";}
)

It was trying to insert an empty 'value' into the database table "webform_component"'s "value" field which doesn't allow empty (Null) values.

mysql field allow null

I manually checked it to Allow Null so I could proceed on to add components, but its just a temporary workaround, may not even be a solution.
I guess the module maintainer has to provide a fix for this...

arunkumark’s picture

Status: Active » Needs review
StatusFileSize
new553 bytes

Hi,
Am also try to create the forms using webform 8.x.4-dev faced problems on fatal
As per comment #3 i replicated the issue and patched for that.

Some other issues:
1. Can't create webforms when attached to another content types. it always show blank list.
2. Select Options(Select list, Radio or checkbox option) is not exist in drupal 8

If any one Guide me i can help to fix mentioned issues.

Status: Needs review » Needs work

The last submitted patch, 6: webform_fatal_error_2637114_6.patch, failed testing.

The last submitted patch, 6: webform_fatal_error_2637114_6.patch, failed testing.

alex.mazaltov’s picture

The same issue have been reproduced on email component creation
#6 for me is working well

sk33lz’s picture

I'm not sure exactly why it's failing testing, but #6 is working to fix the issue with adding email fields to a webform node.

CatherineOmega’s picture

The patch in #6 solves adding email fields to a webform for me as well. I think it just needs to be rerolled with consistent indents. Regardless, it actually DOES work.

arunkumark’s picture

StatusFileSize
new631 bytes

Hi,
As per comment #11 i re rolled patch with proper indentation.

navneet0693’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: webform_fatal_error_2637114_11.patch, failed testing.

The last submitted patch, 12: webform_fatal_error_2637114_11.patch, failed testing.

navneet0693’s picture

+++ b/src/ComponentBase.php
@@ -264,9 +264,13 @@ class ComponentBase extends PluginBase implements ComponentInterface {
+    ¶

Remove extra spacing. And what's the result of simpletest testing on local ?

manpreet saini’s picture

The patch in #6 solves adding email fields to a webform for me as well.Thanks

fenstrat’s picture

Status: Needs work » Closed (outdated)

Closing to clear out the old Webform 8.x-4.x branch. See #2827845: [roadmap] YAML Form 8.x-1.x to Webform 8.x-5.x.