When a component is saved, all [extra] values that are an empty string get discarded. A potential problem with this is if the component default for that field is not an empty string and the input is a textfield. In that case, if the user clears the textfield (assuming the field is not required) and saves the component, the empty string they entered will not get saved, and upon returning to the edit form they will find the default value again populating that field instead of the empty string they tried to save.

This patch (against 4.x) fixes this problem and reduces the size of data stored in sql by comparing values against the defaults instead of comparing them against an empty string.

CommentFileSizeAuthor
extra_defaults.patch917 bytescolemanw
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Thanks! Sounds like a good idea. Are there any specific problems you've encountered?

colemanw’s picture

This problem doesn't crop up with in-built component types because all of their defaults are set to empty strings, but I managed to trigger it while defining a new component type for use with CiviCRM Integration.

I've gotten quite familiar with Webform's internal workings while developing that project - thanks for creating something so extensible!

I'm following 4.x development with interest. I'm especially curious to know if it will ship with a new UI, or if form_builder_webform will continue to be an optional add-on.

quicksketch’s picture

I'm especially curious to know if it will ship with a new UI, or if form_builder_webform will continue to be an optional add-on.

It's hard to say. I designed Form Builder so that it could be used by other projects as well (specifically with Field module), so my original hope had been that both Field module and Webform would use the same form-building UI. However the Field UI hasn't actually materialized and Webform continues to be the only common integration with Form Builder.

quicksketch’s picture

Status: Needs review » Fixed

This patch works great! Thanks for the effort and sorry for my extremely long response time on this one. It's been a long time since I made it all the way through the needs review queue.

quicksketch’s picture

Title: Improving component extra storage » Improve component extra storage to trim out defaults
colemanw’s picture

Glad to help.

Status: Fixed » Closed (fixed)

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