fancybox-related jquery error: Uncaught ReferenceError: ...is not defined

fancybox-related jquery error: Uncaught ReferenceError: ...is not defined

Fancybox glitch. When a link on a particular page is clicked, this gravity forms fancybox pop up window should apppear (as it does on all other pages). But on one page, instead I see just the ajax waiting circle appear and then disappear with the following error showing up in google chrome "inspect element" window: 

  1. ReferenceError: gformInitDatepicker is not defined
This is what appears to be the relevant fancybox functions.php code:

----
  1. <script type='text/javascript'>
  2. function ajax_shortcode_run_<?php echo $devl_ajaxshid?>(){
  3. jQuery.fancybox.showActivity();
  4. jQuery.post('<?php  echo get_permalink($post->ID)?>',{sc_ajax:1,action:'ajax_shortcode',post_id:<?php echo $post->ID?>,nonce:'<?php echo $devl_scajax_nonce?>',shortcode:"<?php echo addcslashes ($c,'"')?>"},function(resp){
  5. jQuery('#ajaxsh_<?php echo $devl_ajaxshid;?>_cnt').html(resp).find('div.gform_wrapper').css('display','block');
  6. // jQuery.fancybox.resize();
  7. var zi=jQuery('#ajaxsh_<?php echo $devl_ajaxshid;?>').fancybox().css("z-index");
  8. jQuery.fancybox.hideActivity();
  9. gformInitDatepicker();
  10. jQuery('#ajaxsh_<?php echo $devl_ajaxshid;?>').trigger('click');
  11. jQuery('#ui-datepicker-div').css("z-index",Number(jQuery('#fancybox-content').css("z-index"))+10);
  12. // jQuery.triggerReady();
  13. });
  14. return false;
  15. }
  16. </script>