Dataface date problem (“2011”) [SOLVED]

Archived from the Xataface Users forum.

borghstijn — Tue Jan 11, 2011 9:32 am

Hi guys,

we have dataface running on our website as a ‘backoffice’ for our database. It’s the old one, dataface, not xataface I think it’s 0.7.1 according to the change.txt - Never needed to update it i guess

Anyways, we now have the strange problem that the date widget in our forms doesn’t know it’s 2011 - it only ranges from 2001 to 2010! I have no real experience with this kind of projects, and the dataface implimentation was my first and last try at it (so it must be somewhat easy haha)

  • Can someone help me out here? I’m guessing it’s just a simple modification somewhere - but *where*?

Thanks!

edit: Ah i solved it in dataface\lib\HTML\QuickForm\date.php is a min and a max year


FractalizeR — Tue Oct 04, 2011 5:29 am

This is still the case for latest 1.3rc6 xataface release. I had to change it manually also.


shannah — Tue Oct 04, 2011 9:29 am

Thanks. I’ve posted this in the issue tracker. I haven’t used the date widget in ages.
http://bugs.weblite.ca/view.php?id=852


ADobkin — Tue Oct 04, 2011 2:58 pm

I often use the date widget for time fields rather than the default time widget, because it uses separate selectors for hours, minutes, am/pm, etc. The time widget, on the other hand, combines them into a long list, which requires a lot of scrolling, especially if the interval is smaller than 30 minutes.

Regarding the maxyear limitation, I agree that this should be extended in the date widget source code. But it can also be changed easily on a per-field basis in the fields.ini file. I set mine up that way a few years ago, so I never noticed this bug. Simply add the following line to any fields using the date widget to extend the years to 2020:

widget:maxYear = 2020

Alan


FractalizeR — Tue Oct 04, 2011 11:17 pm

widget:maxYear is not documented here. Should it be?

I have also discovered, that all the options listed at QuickForm component are available to be provided as widget:XXXX in fields.ini. For example, for widget:type = date they are:

Code: Select all
var $_options = array(         'language'         => 'en',         'format'           => 'dMY',         'minYear'          => 2010,         'maxYear'          => 2020,         'addEmptyOption'   => false,         'emptyOptionValue' => '',         'emptyOptionText'  => ' ',         'optionIncrement'  => array('i' => 1, 's' => 1)

So, I’ve added to one of my fields the following:

Code: Select all
widget:type = date widget:minYear = 2009 widget:maxYear = 2014 widget:format = "dmYHis"

And it works!

I think this should be explicitly documented somewhere around fields.ini


shannah — Tue May 08, 2012 3:34 pm

I have fixed this in SVN. Will be included with 1.3.3