Attempting to reset (add) components has no effet.
Attempting a global reset has no effect the first time, and crashes when trying again:

PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2-1' for key 'PRIMARY': INSERT INTO {webform_component} (nid, cid, pid, form_key, name, type, value, extra, required, weight) 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); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => prenom [:db_insert_placeholder_4] => Prénom [:db_insert_placeholder_5] => textfield [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => a:14:{s:13:"title_display";s:6:"inline";s:7:"private";i:0;s:15:"wrapper_classes";s:0:"";s:11:"css_classes";s:0:"";s:5:"width";s:0:"";s:9:"maxlength";s:0:"";s:12:"field_prefix";s:0:"";s:12:"field_suffix";s:0:"";s:8:"disabled";i:0;s:6:"unique";i:0;s:11:"description";s:0:"";s:11:"placeholder";s:0:"";s:10:"attributes";a:0:{}s:8:"analysis";b:0;} [:db_insert_placeholder_8] => 1 [:db_insert_placeholder_9] => 0 ) dans webform_component_insert() (ligne 785 dans /[...]/sites/all/modules/webform/includes/webform.components.inc).

Comments

anrikun’s picture

Edit:
This seems to happen on a existing node without components yet.
Actually components do get created behind the scene but do not show up until an extra component is manually added.
You then end up with duplicate components (as many as the times you tried to reset them).

The Webform share module seems to be affected by the exact same bug, so changes in Webform core itself must be the source of the problem.

kruhak’s picture

Status: Active » Postponed (maintainer needs more info)

Hello anrikun,

Unfortunately I cannot reproduce this issue.
What do you mean saying "Actually components do get created behind the scene"?

so changes in Webform core itself

Does this mean that you have any hacks in Webform module or may be you upgraded module from previous versions?

What version of Webform module you use?

anrikun’s picture

Hi kruhak,

I'm using the official and untouched 7.x-4.9 version of Webform.
Webform was already installed (and updated several times) before I decide to install Webform Default Fields.
Webform nodes already existed as well.
All of them had the same fields and I needed to update these fields.
Instead of modifying each webform one by one, I installed Webform Default Fields so that I can create global fields and reset the fields of all the forms.
After creating the global fields, I attempted a global reset.
But when I had a look at one of the webforms, nothing had changed.
I tried again and I got a crash.
Eventually, I noticed that the fields had been reset as expected but webform simply wouldn't display them.
To make them show up, I had to manually create a dummy extra field on the webform.
Obviously, this refreshed something behind the seen, making reset fields appear.
This must affect only webform nodes existing prior to Webform Default Fields installation.
That's maybe why you couldn't reproduce the bug...

volker23’s picture

I'm experiencing the exact same error. Is there something new on this?

esolitos’s picture

I briefly tested this module, same issue occurred also in my setup. :)

Latest webform module + latest Webform default fields module.

kthull’s picture

Confirming.

Using Webform 7.x-4.10 and Webform Default Fields 7.x-4.5, if I use the reset form to add fields to an existing node, and then hit the reset button, there is no visual change. The checkboxes become unchecked and the components tab shows no components.

Upon adding a component after a reset, the default fields will then display.

Note that using reset to remove the additional field has an immediate, and expected, effect.

Also worth mentioning: clearing cache after the reset also had no effect.

usdv’s picture

Hello guys,

I still can't reproduce this bug. At all. I checked this on a clean installation and on a existing site with various content. Maybe someone who faced with this bug can provide some detailed information about their installation?
Still need more info.

esolitos’s picture

@usdv:
I'll try to find what's the source of this in my setup when i have some time to dedicate! I can't assure much, since lately i've been quite busy, but i do totally understand that if you can't replicate, you can't fix it. :)

kinosura’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
.bert’s picture

Status: Closed (cannot reproduce) » Active

I'm experiencing the same thing.

Here's a rough breakdown of how I arrived here:

  • Created a content type without enabling webform functionality
  • Created numerous nodes in that content type
  • Subsequently enabled webform functionality on the content type
  • Setup the Default Webform Fields for the content type (admin/structure/types/manage/{content-type-machine-name}/webform-fields)
  • Attempted to apply the reset to any of the already created nodes
  • No change gets applied to the webform for the node, regardless of using component reset or global reset

When I do try a global reset a second time, I get the same error as @anrikun describes, "Integrity constraint violation: 1062 Duplicate entry '{#}' for key 'PRIMARY'; INSERT INTO {webform_component} ...

I'll post more info if I can find a workaround.

rreiss’s picture

I'm having the same issue with the latest dev version.
In my case it added one field (fieldset), but didn't add the rest of the fields "under" the fieldset, and using the global reset crashes with "Integrity constraint violation".

.bert’s picture

Just to add to this, what I can see in the database is that no record is being created in the `webform` table when I'm resetting the components on a given node.

It appears that typically, this table holds basic information about the webform settings for a given node based on the `nid`. In my case, nothing is created here.

Upgrading to latest dev partially resolved the issue, in that it allowed me the ability to use the "Global reset" on individual nodes for Form components and they subsequently displayed the webform with all the correct fields. However, the Form Preview on the admin side remained blank. Checking it again a few days later and the Form Preview is also now properly populated. It's possible it was a cache issue for the Form Preview, but the cache had been cleared with no effect at the time of reset.

If an attempt was made to reset the node prior to applying the latest dev of the module, that node's webform still cannot be reset.

Hopefully this is helpful, but latest dev looks like a significant improvement.

  • adci_contributor committed 2c8aa5c on 7.x-4.x
    Issue #2508121: Reset components has no effet, global reset crashes
    
adci_contributor’s picture

Hi! All changes are added to dev, we will add it to stable as soon as possible, please check. Thanks to all of here!

gaëlg’s picture

I faced the same bug and tried latest dev. I cleaned webform_component and webform_emails, then went to a previously existing node and launched a complete global reset of the node.
No error, but apparently nothing gets reset. Lines are added in webform_component, so that it will fail if I do it again. The form components do not appear in front, nor in edit form. No lines added in webform table.

trinsic’s picture

Im getting the same error when I try to apply reset to an already created node It only happens randomly depending on what sequence you take. For me I tried to reset the fields using the check boxes and applying the reset operation a few times, then try reset all nodes. When it did not work to reset the fields on a already created node I then tried to globally reset the node using the global reset button, I checked all the options and clicked Global reset and got an error.

Im thinking this module is a good attempt at addressing the single form single node problem, but I dont think its the best approach to solving this issue. It seems like it would be better to create a separate webform option than to try to override the existing one.

Anonymous’s picture

I am having the same as #15: no error, nothing happens...

Anonymous’s picture

Version: 7.x-4.5 » 7.x-4.6

For versions dev and 4.6

Or maybe the workflow is not clear to me.

adci_contributor’s picture

Hello everyone!
If you want to use the “Reset” function for already existing content, you need to change the content type. You need to enable “Enable webform functionals” and “Webform default field”. If you do not check “Webform default field” for this content type and try to use the “Reset” functions, you will get this error described in this issue.
If you receive this error when you enable “Webform default field” in a content type, please, check the node that was specified in error. Perhaps there will be two identical fields. If you delete one of them, the error will no longer appear.
ID nodes with duplicate fields you can see from the error. This is the first numeric in the error text

Duplicate entry ‘2-1’ for key 'PRIMARY': INSERT INTO {webform_component}...

  • adci_contributor committed 1943495 on 7.x-4.x
    Issue #2508121 by adci_contributor: Reset components has no effet,...
adci_contributor’s picture

We’ve added some changes. Now you can add default fields and use the “Reset” function in existing content.

adci_contributor’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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