datefield calendar

17 years 3 months ago #30767 by benny87
datefield calendar was created by benny87
Hi!
How can I change the default datefield into a dropdown selection? It would help me if anyone can tell me the position where the datefield is described.

Thank you!

Please Log in to join the conversation.

17 years 3 months ago #30952 by benny87
Replied by benny87 on topic Re:datefield calendar
Nobody here who has an issue? :(

Please Log in to join the conversation.

17 years 3 months ago #30953 by mikko
Replied by mikko on topic Re:datefield calendar
People have issues, but not solution. The calendar popup is created with a 3rd party script. Search for calendar.js or similar string in the source code.

Making date a drop down requires probably some non-trivial coding, since you would need to figure a way to first "sum up" three drop downs to a single field value.

mikko

Please Log in to join the conversation.

17 years 2 months ago #31782 by serkany
Replied by serkany on topic Re:datefield calendar
I think another solution is definetly needed for the date field. People find it quite complex and I personally agree. It's not easy to understand its logic for an avarage internet user. Besides you can't select whatever year you want, you have to select the nearest one and then move one by one.

If anybody has an alternative solution, it'll be very useful in my opinion...

Regards,
Serkan

Please Log in to join the conversation.

17 years 2 months ago #32808 by rberthelette
Replied by rberthelette on topic Re:datefield calendar
At first I thought the calendar control was pretty neat, but now I would have to agree that it is complex for the "average" Internet user. I had some people do some usability testing for me and the calendar was the first thing they complained about.

I think for now I'm going to use a standard text box in in the description put the following:

MM/DD/YYYY (i.e. 09/17/1966)

I suppose I could look at the code and put in some PHP or Javascript validation on this text field as well.

Cheers,
Ray

Please Log in to join the conversation.

17 years 1 month ago #34909 by mankyd
Replied by mankyd on topic Re:datefield calendar
It shouldn't be too hard to create 3 drop downs (YYYY, MM, DD). Just use a hidden field that contains the actual date value, and update it whenever an onchange event occurs. The receiving php page would ignore the values from the 3 selects and just use the hidden field's value:

[code:1]
<script type="text/javascript">
function update_date(which) {
document.getElementById(which).value = document.getElementById(which+'_year') + document.getElementById(which+'_month') + document.getElementById(which+'_day');
}
</script>
<input type="hidden" name="date_input" id="date_input" />
<select onchange="update_date('date_input')" id="date_input_year" name="date_input_year">
<option>2007</option>
...
</select>
<select onchange="update_date('date_input')" id="date_input_day" name="date_input_month">
<option>01</option>
...
</select>
<select onchange="update_date('date_input')" id="date_input_day" name="date_input_day">
<option>01</option>
...
</select>
[/code:1]

Or, even simpler, use no javascript at all! If the desired field name is "date_input" then, in the receiving php, just add something like:
[code:1]$_POST[$field_name.'_year'].$_POST[$field_name.'_month'].$_POST[$field_name.'_day'].[/code:1].

This would be incredibly useful because the current data control is really non-accessible and non-intuitive. Most of my users are getting the day and month correct, but few are putting the correct year, (unless I have a lot users born in 2007 :P)

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.226 seconds

Facebook Twitter LinkedIn