Forums

Datepicker editable

enzo.orsi 23 Aug, 2015
Hi,
is there any way to make datepicker editable manually?
If you need to fill the birth date is quite complicated, because you have to scroll back till birth year...

Thank you!
GreyHead 23 Aug, 2015
Hi enzo.orsi,

Not easily and allowing manual entry gives you messy validation problems. For a birth date you should set the datepicker to start in Year view then you can click back 20 years at a time.

Bob
enzo.orsi 24 Aug, 2015
Thank you Bob, I already changed to start in Year.
Is there any way also to start for example in 1970?
GreyHead 24 Aug, 2015
Answer
1 Likes
Hi enzo.orsi,

Hmmm . . . I was able to do it by setting a default date for the picker using code like this in a Custom Code action before the HTML (Render Form) action in the form On Load event.
<?php
if ( empty($form->data['datepicker1']) ) {
  $form->data['datepicker1'] = '01-01-1970';
}
?>
Change datepicker1 to the name of your datepicker.

The if() part is there so that any existing date is not over-written.

Bob
This topic is locked and no more replies can be posted.