2

I cannot seem to enable profiles on contribution pages. There are no drop-down menus for including profiles, and when I try to type in an existing profile, I get a page with "DB: error: constraint violation." What am I missing? (I am using CiviCRM 4.6.3 on Wordpress 4.2.2.)

Update: Here is a screenshot of the page: enter image description here

Update:Here is the error/backtrace:

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (rpwrhsor_civicrm.civicrm_uf_join, CONSTRAINT FK_civicrm_uf_join_uf_group_id FOREIGN KEY (uf_group_id) REFERENCES civicrm_uf_group (id)), 1452 Additional Details: Array ( [callback] => Array ( [0] => CRM_Core_Error 1 => handle )

[code] => -3
[message] => DB Error: constraint violation
[mode] => 16
[debug_info] => INSERT INTO civicrm_uf_join (is_active , module , entity_table , entity_id , weight , uf_group_id ) VALUES ( 1 , 'CiviContribute' , 'civicrm_contribution_page' ,  3 ,  2 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`rpwrhsor_civicrm`.`civicrm_uf_join`, CONSTRAINT `FK_civicrm_uf_join_uf_group_id` FOREIGN KEY (`uf_group_id`) REFERENCES `civicrm_uf_group` (`id`))]
[type] => DB_Error
[user_info] => INSERT INTO civicrm_uf_join (is_active , module , entity_table , entity_id , weight , uf_group_id ) VALUES ( 1 , 'CiviContribute' , 'civicrm_contribution_page' ,  3 ,  2 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`rpwrhsor_civicrm`.`civicrm_uf_join`, CONSTRAINT `FK_civicrm_uf_join_uf_group_id` FOREIGN KEY (`uf_group_id`) REFERENCES `civicrm_uf_group` (`id`))]
[to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_uf_join (is_active , module , entity_table , entity_id , weight , uf_group_id ) VALUES ( 1 , 'CiviContribute' , 'civicrm_contribution_page' ,  3 ,  2 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`rpwrhsor_civicrm`.`civicrm_uf_join`, CONSTRAINT `FK_civicrm_uf_join_uf_group_id` FOREIGN KEY (`uf_group_id`) REFERENCES `civicrm_uf_group` (`id`))]"]

)

3
  • This is a good question! To solve your problem, we'll need to see the expanded debugging information. In CiviCRM, please go to Administer menu > System Settings > Debugging and Error Handling, select "Yes" to both "Enable Debugging" and "Display Backtrace", and press "Save". Repeat the problem that caused your error, and you'll see much a much more detailed error. Please update this question with the expanded error and backtrace - and don't forget to disable debugging/backtrace when you're done! Commented Jun 3, 2015 at 16:36
  • OK - I think this error might be a red herring. I should have paid more attention to the part where you said you "tried to type in an existing profile". That should be impossible, and your error is tied to that. Can you please post a screenshot of what the "Include Profiles" screen on looks like when you're managing this contribution page? Commented Jun 3, 2015 at 21:40
  • I added the screenshot
    – raaboyl
    Commented Jun 3, 2015 at 22:58

3 Answers 3

1
  1. Can you compare your screen with this page:

http://wp46.demo.civicrm.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/contribute/custom&reset=1&action=update&id=2

(you will need to login as demo / demo)

  1. I suspect its not the same, and most likely there are some javascript errors occuring on your site. You should check the js console when you load the page

  2. Seems like the values submitted (i.e. a 0 for uf_group_id) is not expected and hence u get the mysql error

2
  • Yeah, a javascript error that causes badly submitted data that causes a server error, nasty! Keep that javascript console open ...
    – Alan Dixon
    Commented Jun 4, 2015 at 15:18
  • It was not the same, but when I went back into my CiviCRM, it worked like it did in the demo. If it happens again I will keep an eye on the javascript. Thank you!
    – raaboyl
    Commented Jun 6, 2015 at 16:50
0

I'm currently running into the same issues, which a check on the js console reveals is caused by javascript errors.

The error message reads as follows:

JQMIGRATE: Migrate is installed, version 1.4.1 
crm.designerapp.js?r=uMjIi:11 Uncaught TypeError: Cannot read property 'Application' of undefined
at HTMLDocument.<anonymous> (crm.designerapp.js?r=uMjIi:11)
at j (jquery.js:3148)
at Object.fireWith [as resolveWith] (jquery.js:3260)
at Function.ready (jquery.js:3472)
at HTMLDocument.J (jquery.js:3503)
backbone.collectionsubset.js?r=uMjIi:225 Uncaught TypeError: Backbone.CollectionSubset is not a constructor at child.Backbone.Collection.subcollection (backbone.collectionsubset.js?r=uMjIi:225)
at HTMLInputElement.<anonymous> (jquery.crmProfileSelector.js?r=uMjIi:34)
at Function.each (jquery.js:384)
at m.fn.init.each (jquery.js:136)
at m.fn.init.$.fn.crmProfileSelector (jquery.crmProfileSelector.js?r=uMjIi:25)
at HTMLInputElement.<anonymous> (jquery.crmProfileSelector.js?r=uMjIi:89)
at Function.each (jquery.js:384)
at m.fn.init.each (jquery.js:136)
at HTMLDivElement.<anonymous> (jquery.crmProfileSelector.js?r=uMjIi:88)
at HTMLDivElement.dispatch (jquery.js:4670)

Any advice on resolving these errors?

1
  • Thanks, Xavier, for the heads up on Jetpack as the likely culprit. I disabled it, and lo and behold, the dropdown menus for the profiles returned. Many, many thanks!
    – Justin
    Commented Dec 30, 2016 at 3:29
0

It's likely a problem/conflict with the javascript from another module.

From this thread on our old forum: https://forum.civicrm.org/index.php?topic=35079.msg149115#msg149115

might be "Jetpack". Try to disable it to see what's happening.

In general: disable the other modules until you find the one that conflicts with civi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.