Not letting me leave a date field blank

5 posts by 4 authors in: Forums > CMS Builder
Last Post: October 15, 2010   (RSS)

On the site I am working on there is a vacancies page.
It's all working but at the moment there are no vacancies and I want to leave the closing date field blank or at least 00/00/00 but there is not option for me to do this. Any ideas?

Re: [Kittybiccy] Not letting me leave a date field blank

By Dave - January 16, 2009

Hi Kittybiccy,

There's no way to do that currently.

Another solution might be to have a checkbox field for "no_vacancies" or "hide_date" and not show the date if that is checked with some code like this:

<?php if ($record['no_vacancies']): ?>
Sorry there are no vanancies
<?php else: ?>
... display date here ...
<?php endif ?>

Let me know if that will work for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [zickey] Not letting me leave a date field blank

By Jason - October 15, 2010

Hi Zickey,

What could be happening is there is a zero value in your end_date field. Try this code:

<?php if ($record['end_date'] && $record['end_date']!=0): ?>
<h4>Event Ends: <?php echo date("D, M jS, Y g:i:s a", strtotime($record['end_date'])) ?></h4>
<?php endif ?>


If this doesn't work, try:
<?php showme($record['end_date']);?>
to output exactly what value is being stored in end_date.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Not letting me leave a date field blank

By Mikey - October 15, 2010

Thanks Jason... seems to be functioning perfectly.
The Interactive Tools team ROCKS!!!!