Empty Date displays default date

21 posts by 5 authors in: Forums > CMS Builder
Last Post: August 24, 2011   (RSS)

By trebien - August 15, 2011

Setting up an "events" page... leaving the date field empty in the editor, but the PHP output shows a date in 1999 instead of nothing. Some event have no date associated with them, so if it's blank, I want the field to remain blank...

Any thoughts?

Re: [trebien] Empty Date displays default date

By Steve99 - August 16, 2011

Hello,
Go to Admin -> Section Editors, and click modify on your "events" editor. Then click modify for your date field. In the Field Options area, change the default value to "None/Blank" and that should do the trick!

Hope this helps.

Re: [steve99] Empty Date displays default date

By trebien - August 17, 2011

That's the thing... that's how we have it set!

We also tried changing that option, saving... then changing it back... but same thing... weird.

Re: [steve99] Empty Date displays default date

By trebien - August 17, 2011

Yeah, it looks like this is what we will have to do... I'm just trying to figure out why the original functionality isn't working.

Re: [trebien] Empty Date displays default date

By robin - August 17, 2011

Hey,

Are you directly outputting the date field? Like
<?php echo $record['date'] ?>
Or are you running it through any functions first?

Thanks,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Empty Date displays default date

By trebien - August 17, 2011

Just the code generated by the Code Generator:

<?php echo date("D, M jS, Y g:i a", strtotime($record['date'])) ?>

Re: [trebien] Empty Date displays default date

By robin - August 17, 2011

Is the wrong date that it's outputting November 30th, 1999?

Thanks
Robin
Programmer
interactivetools.com

Re: [robin] Empty Date displays default date

By trebien - August 17, 2011

Yeah, some default date.

Re: [trebien] Empty Date displays default date

Hi,

Try the removeExtraWhitespace plugin that Dave Edis created (attached).

It automatically checks for fields that only contain blank spaces as well as blank dates.

The plugin requires 2.05

That should get you going,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php