so. I need to create an input for Date Of Birth.
The datepicker UI doesn’t appear to allow free text, and assuming it starts with today’s date, that’s a lot of clicking to get back to the 1970s or earlier it’s not an acceptable user experience.
In my dataset it’s a date type. Right now i’m thinking of switching it to a text and just allowing free text with a regex validator, but the calendar would be nicer if I can make it usable. Maybe add a 10year step in addition to 1 year kind of like:
<< < 2018 > >>
Not sure how/if I can get at the code that renders that picker.
I’m brand new to WIX but experienced programmer and fluent HTML/CSS/JS. If I could just get under the hood… any tips appreciated
i think i can go for a text field with a regex pattern validator. User enters date in a ‘normal’ format like 18/02/1965 and then i can use a change event, take input and make a valid date obj i.e. new Date(‘1965/02/18’). Guess the question now is how/if i can make my own custom form controls? time to RTFM
Hi Neil,
You can also use dropdown boxes, one for selecting the day, month and year, then combine the values when all fields are valid.
function calcDate() {
if ($w('#day').value && $w('#month').value && $w('#year').value) {
$w('#text4').text = `${$w('#day').value}.${$w('#month').value}.${$w('#year').value}`; //i.e 19.4.1943
}
}
You can check out the end result here
Thanks for the feedback - looks good I could take that approach - guess i’m being lazy. It also requires a little more work to handle e.g. 28 days in february , months with 30 days and leap years. I’m just surprised no-one has encountered the need to easily enter historical dates before - the best solution would be to modify the existing calendar control to allow rapid selection of the year.
A post was split to a new topic: Date picker dates before 1900