Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

DatePickerField not popping up calendar


Reply

30 Posts   5941 Views

Avatar
UncleCheese

16 September 2009 at 2:10am 4085 Posts

This is bizarre. Shawn, what is the difference in the output of using BaseHref() vs leaving it out in terms of the path it creates in your source code?

When I use something like:

Requirements::javascript("jsparty/some_file.js");

The result in my source code is:

<script src="http://www.mysite.com/jsparty/some_file.js"></script>

So it shouldn't make a difference. The Requirements class must be thinking that file doesn't exist for some reason.

Just humor me, and get the result of Director::fileExists('jsparty/jquery/jquery.js'); for me. My expectation is that it will come back false.

Avatar
Shawn Parr

16 September 2009 at 2:20am Community Member, 60 Posts

I know, it is totally crazy.

I changed the DatePickerField.php file to this:

function Field() {
Requirements::javascript("dataobject_manager/javascript/jquery-ui-1.6.js");
   Requirements::javascript($this->BaseHref() . "jsparty/jquery/plugins/livequery/jquery.livequery.js");
   Requirements::javascript("dataobject_manager/code/date_picker_field/datepicker.js");
   Requirements::javascript("dataobject_manager/code/date_picker_field/datepicker_init.js");
      Requirements::css("dataobject_manager/css/ui/ui.all.css");   
      
      if(Director::fileExists('jsparty/jquery/jquery.js')) {
         Requirements::customScript("alert('File Exists')");
      } else {
         Requirements::customScript("alert('File does not exist')");
      }

The result was 'File Exists.' I then removed it from there and added it to DataObjectManager.php and got 'File Exists.' Which makes absolutely no sense whatsoever.

If you would like me to do anything else, or format the code differently, please let me know. I'm fairly open for this stuff today, as I'm working on integrating some javascript things and not under specific deadlines today or tomorrow.

Avatar
Juanitou

19 September 2009 at 4:59am Community Member, 323 Posts

Hi!

In my case, this error ('jQuery is not defined') was only happening in my 'live' shared host and not in the local WAMP server I use for development. I found it when trying to attach images from the Assets folder to pages through a ImageDataObjectManager: the Assets dropdown was showing up, but selecting a folder did not triggered the loading of the images.

Hope it helps,
Juan

Avatar
UncleCheese

19 September 2009 at 5:18am 4085 Posts

Right, I get what the error is and when it happens, but what I'm trying to figure out is why it only happens on some systems. Are there any notable differences between your dev and production environments?

Avatar
Juanitou

22 September 2009 at 3:30am Community Member, 323 Posts

Hi!

I don't know what is the relevant information concerning configuration differences, but I know that to install SS in my shared host I have to manually modify some lines of ManifestBuilder (replacing $baseDir with '//'), something related to PHP running in safe_mode with open_basedir = '/'.

Also my local development server is WAMP (WampServer 2.0) and the live one is LAMP, but I don't think it matters.

Best regards,
Juan

Avatar
UncleCheese

26 September 2009 at 3:36am 4085 Posts

Well, guys. The fix is in. I've decided to stop wondering why and just go with what works. Thank you all so much for your diligent testing.

Avatar
Jeramie

19 November 2009 at 5:22am (Last edited: 19 November 2009 5:22am), Community Member, 34 Posts

I also had this issue on Silverstripe 2.3.3 with event calendar r83. I followed the solution at http://www.silverstripe.org/dataobjectmanager-module-forum/show/268609?start=8#post268755

Thanks for everyone posting and testing this. I guess I should have dug deeper prior to my posting it as a separate problem. Thanks!

Avatar
edeis

24 March 2010 at 12:05pm Community Member, 4 Posts

I am getting the same problem with the DatePickerField not displaying. Javascript errors throw the error "jQuery is not defined".

I am running the following:

-Silverstripe 2.3.7 (was having the same error in 2.3.3 and thought may upgrading would fix it, but no)
-event_calendar-r88
-dataobject-manager-r388
-blogmodule