Try our conversational search powered by Generative AI!

How to submit birth date using drop down fields


In our project we have a section called 'Personal Details' where a user can update information about themselves, including their birth date. At present, our form for this page has three separate fields for `DD` `MM` and `YYYY`. We can then take these individual entries, process them and save them against a user in the database.

However, we need to make sure that an invalid date cannot be entered, for instance 31 - 02 - 1985

For other dropdown values in this page we have used the `PropertyList` functionality which works well. An example being `Salutation` where we have: Mr, Mrs, Ms etc.

Is there a way to create a drop down list that responds to the selection of another drop down list?

For instance,:

  1. I navigate to my `Personal Details`
  2. I select `09` as a month
  3. When I go to select a day I am presented with 1- 30
  4. I then select `08` as a month
  5. When I go to select a day I am presented with 1- 31

My second question concerns the year. Is there a way to programmatically populate this dropdown with a long list of years? Otherwise we will have to manually add them, especially if we use the `PropertyList` approach.

For reference I have pastaed a screenshot of our design below:

Jul 08, 2022 10:40

It sounds like this is a custom form if you're using a PropertyList for values. Can you confirm if this is an Optimizely Form or something custom?

Optimizely Forms has depedent fields so you can have other fields being shown/set based upon the previously entered values so you could do this although I'd personally say maybe it's easier to just use a date picker where that's all built in.

Jul 12, 2022 11:23

We are using a custom form, Scott. Not an Optimizely Form. 

Can you recommend in built-in date pickers that I can use for the custom form?

Jul 12, 2022 12:23

The most common one is the jQuery datepicker if you're using jQuery however if it's a custom form you could easily build those dependent fields you want using simple JavaScript or a whatever front end framework you're using for the form.

Jul 12, 2022 21:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.