Jump to:

23556 Posts in 19383 Topics by 2892 members

General Questions

SilverStripe Forums » General Questions » Date Field ins't saving to database, Jquery UI calendar weirdness

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 750 Views
  • primer
    Avatar
    Community Member
    3 Posts

    Date Field ins't saving to database, Jquery UI calendar weirdness Link to this post

    For some reason new date fields created in an already existing install of Silverstripe (2.5.4) won't save to the database. The date field is inside a widget, perhaps that is the issue?

    Code snippet:

    static $db = array(
    'startDate => Date',
    );

    function getCMSFields() {
    return new Fieldset(
    new datefield('startDate')
    );
    }

    This generates a date field in the database and displays the field in the backend, however, whenever I try to save the page, the date disappears without getting saved. My console reports no errors. I've also tried using the datepicker calendar, but this is also unsuccssful. When the user clicks on a day, they are redirected back to the home page. That does return an error on line 859 of the jquery UI Datepicker code. The error is "can't set currentDay of undefined."

    This install of SS is using the blog module, and the date fields for the BlogEntry page work perfectly. It doesn't redirect and correctly saves to the database.

    If anyone has encountered this error before and/or has any ideas on fixing, I'd love to hear them!

    Thanks
    Adam

  • danzzz
    Avatar
    Community Member
    175 Posts

    Re: Date Field ins't saving to database, Jquery UI calendar weirdness Link to this post

    dev mode enabled?

    if not, try: http://www.silverstripe.org/general-questions/show/18873

    by the way, snippet should look:

    static $db=array(
    'startDate' => 'Date'
    )

  • primer
    Avatar
    Community Member
    3 Posts

    Re: Date Field ins't saving to database, Jquery UI calendar weirdness Link to this post

    My mistake, that was a typo, the code is actually correct in my php file.

    I should have been more clear. Dev mode is indeed enabled. I don't get that "error saving content message" in the lower left hand corner of the backend, I actually get the "content saved successfully" message.

    The only error message I get references the jQuery UI datepicker. I haven't edited the file and it works with the blog module install. The 'undefined' part seems to back up the fact that the variable in the StartDate field isn't getting saved; again I have no idea why.

    I should also mention that other fields within the widget save to the database without incident.

    Thanks,
    Adam

    750 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.