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.

All other Modules /

Discuss all other Modules here.

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

extending DataExtension


Reply


4 Posts   463 Views

Avatar
Riposte

Community Member, 10 Posts

6 August 2013 at 4:52pm

Edited: 06/08/2013 4:53pm

Hi All
I'm not exactly top shelf when it comes to the coding stuff and could use a bit of help with where to look for the error causing my problem.
I have made a minor extension to the CalendarDateTime Class to add three new fields:
New file MeetDetails.php in mysite/code folder:
<?php

class MeetDetails extends DataExtension
{
private static $db = array(
'Location' => 'Text',
'Entries Close' => 'Date',
'No Times' => 'Boolean'
);

private static $has_one = array (
'Event' => 'CalendarEvent'
);

public function updateCMSFields(FieldList $fields) {

$fields->push(new TextField('Location', 'Location'));
$fields->push(new DateField('Entries Close', 'Date Entries Close'));
$fields->push(new CheckboxField('No Times', 'No Times Allowed'));
}
}

and added;
Object::add_extension('CalendarDateTime', 'MeetDetails');

to my _config.php file.

Ran dev/build?flush=1 and new fields appear in database and in CMS as expected.

The problem is only the 'Location" textfield will save any data. With the other two you can set them all you like but they wont save anything.
Pushing the 'Save" button reloads the page but the two fields reset to blank.

Where should I start looking to solve this?

Any help appreciated.

Avatar
Riposte

Community Member, 10 Posts

16 August 2013 at 4:02pm

Edited: 16/08/2013 4:09pm

Still havn't solved this - have I logged it in the right part of the forum?
A advice on how to debug this sort of problem even?

Avatar
Pigeon

Community Member, 243 Posts

16 August 2013 at 7:39pm

Try removing the spaces from the DB field names?

Avatar
Riposte

Community Member, 10 Posts

17 August 2013 at 10:47am

Thanks Pigeon - that sorted it.
New it would be something simple that would probably highlight my noobishness (is that a word?).