Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defaults to resetFields call when creating new contact #151

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

AsylumSeekersCentre
Copy link
Contributor

@AsylumSeekersCentre AsylumSeekersCentre commented Jul 30, 2018

…in webform_civicrm_forms.js, solving the bug of missing CiviCRM defaults.

Overview

When creating a new contact in a webform, defaults for Civi fields are not preserved, while defaults for non-Civi fields remain. This change preserves the defaults for Civi fields as well.

Before

This is our Test Defaults webform:
webform_civicrm_defaults_01select
Here is what happens when selecting an existing Contact (all defaults are preserved, fields with saved data are updated):
webform_civicrm_defaults_02existing
Here is what happens when creating a new contact (Civi defaults are not preserved):
webform_civicrm_defaults_03create

After

Now all defaults are preserved when creating a new Contact:
webform_civicrm_defaults_04createwithdefaults

Technical Details

The defaults parameter of the resetFields function seems to be relatively new. It looks like it can be used when creating a new Contact, and adding it here doesn't appear to break anything else (but maybe there's a use case I'm not considering).

…_civicrm_forms.js, solving missing CiviCRM defaults bug.
@colemanw
Copy link
Owner

@jitendrapurohit what do you think about this?

@jitendrapurohit
Copy link
Collaborator

@colemanw Confirm that this fixes the issue described above. This is a good change OR an extension of #102 which also fixes the reset of defaults on the new contact creation.

@colemanw colemanw merged commit 537f8a4 into colemanw:7.x-4.x Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants