In all of my custom extensions, when I use the loadForm function to load a form (generated with Civix) as a popup, I get the following error:

Uncaught TypeError: Cannot read property 'split' of undefined
at $.(anonymous function).(anonymous function).isOriginalUrl (http://dev.civicrmdev/sites/all/modules/civicrm/js/crm.ajax.js?pd7a7l:167:34)
at $.(anonymous function).(anonymous function).isOriginalUrl (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery-ui/jquery-ui.js?pd7a7l:144:25)
at HTMLDivElement.<anonymous> (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery-ui/jquery-ui.js?pd7a7l:256:40)
at Function.each (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.js?pd7a7l:370:19)
at jQuery.fn.init.each (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.js?pd7a7l:137:17)
at jQuery.fn.init.$.fn.(anonymous function) [as crmSnippet] (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery-ui/jquery-ui.js?pd7a7l:236:10)
at HTMLDivElement.<anonymous> (http://dev.civicrmdev/sites/all/modules/civicrm/js/crm.ajax.js?pd7a7l:441:34)
at HTMLDivElement.dispatch (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.js?pd7a7l:5226:27)
at HTMLDivElement.elemData.handle (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.js?pd7a7l:4878:28)
at Object.trigger (http://dev.civicrmdev/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.js?pd7a7l:5130:12)

Apparently Civi replaces the default buttons with some other buttons. This error breaks that process. I noticed this when trying to use the Shoreditch theme (my buttons disappeared).

I'm unsure how to approach debugging this. Any ideas on what would cause this with my forms loaded in popups? The standalone page loads just fine with the buttons.

up vote 1 down vote accepted

I just figured it out.

When using the loadForm function you have to include at least 1 parameter in the URL. If you do not include a parameter then you will get the error.

Is this a bug?

  • Most urls in civicrm include the reset=1 parameter. I dont know why. – Jaap Jansma - CiviCooP Aug 13 at 9:25

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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