Topic on Extension talk:Semantic Forms Inputs

Ozstang65 (talkcontribs)

Hi, I've just installed Inputs and I'm having a problem with the datepicker. The year selection seems to be fixed in a 10 year period either side of the default (or last selected) year. Scrolling thru to years not appearing in the list is not possible. MW 1.18, SF 2.3.1, SFI 0.5, SMW 1.6.1.

Fault is not dependednt on the "first date =" variable

I've tried IE on XP an Firefox on Mac OSX, same result.

Is it a bug or a problem with my settings somewhere?

Cheers - Scott

F.trott (talkcontribs)

You are right. What would be the expected behaviour, though?

Ozstang65 (talkcontribs)

Sorry for the delayed reply, been rather busy of late...

I would expect it to keep scrolling back/forward through the years until you stopped pressing the up or down arrow. One of the forms I am using it in is to input a vehicle's year of manufacture. When someone begins to fill out the form and selects the year then they can only scroll back as far as 2001. This may confuse some into thinking that they cannot enter a date prior to that.

F.trott (talkcontribs)

I would like it to work a bit differently than you proposed (e.g. like this, preferably with a click-and-hold feature for fast forward/backward), but I agree, that something like that would be a really nice feature. The problem is, it would require a change to the jQuery datepicker code, which is out of the scope of this extension. I will note it as a feature request, but better don't hold your breath on it.

If you are really intent on having this, you would have to drive it. I.e get someone at jqueryui.com to implement your feature and then kick me again to use it.

(What I probably could do is give you some option where you could set the years shown in the dropdown.)

Ozstang65 (talkcontribs)

Either way would work. I'd be surprised if it's hard to fix the existing control though. When you click on the year control, if you select the earliest year in the list the control disappears and shows the year selected. The next time you click on the control the year previously selected is centred in the list and you can go back another ten years. The control can eventually be 'hacked' to get back to the year that you want, you just can't get there via the scroll buttons.

FrancoIacomella~mediawikiwiki (talkcontribs)

Hi! To change the range of years you can add the following change in the datepicker.js file. Look for this piece of code:

inputShow.datepicker( {
                        'showOn': 'both',
                        'buttonImage': params.buttonImage,
                        'buttonImageOnly': false,
                        'changeMonth': true,
                        'changeYear': true,
                        'altFormat': 'yy/mm/dd',
                        // Today button does not work (http://dev.jqueryui.com/ticket/4045)
                        // do not show button panel for now
                        // TODO: show date picker button panel when bug is fixed
                        'showButtonPanel': false,
                        'firstDay': params.firstDay,
                        'showWeek': params.showWeek,
                        'dateFormat': params.dateFormat,
                        'beforeShowDay': function ( date ) {return SFI_DP_checkDate( '#' + input_id + '_show', date );}
                } );

Then add the following line inside that block:

'yearRange': 'c-200:c+10',

That will change the range of years (200 in the past from today's year and 10 years in the future). More info can be found in DatePicker documentation.

This post was posted by FrancoIacomella~mediawikiwiki, but signed as FrancoIacomella.

Reply to "No year scrolling"