-3

first time posting here so apologies if I break some rules (though I believe I have read them thoroughly).

I am trying to add a DOB field for a form on my webpage. I have come across a website with an example that seems perfect though the website doesn't really give a tutorial on how to get it to look and work exactly like it. The example in question is the "As component." one where the text cannot be edited but the calendar button is available, though I also like the one above but would prefer the format to be DD/MM/YY.

Any help would be amazing and greatly appreciated. Thank you.

- Josh

1 Answers1

2

the website you linked uses Bootstrap, an addon framework that you can use for your website. (You have to include outside scripts and stylesheets), which is fine but needs a little bit of set-up. The best practice is to use the HTML5's date input.

<input type="date">

Special note:

Not all browsers support the date type and isn't supported by Firefox and a few others, therefore you may need to resort to another method.

You can use the text type which is supported by all browsers.

Reference:

These Q&A's on Stack may be of help:

Community
  • 1
  • 1
Dellowar
  • 3,160
  • 1
  • 18
  • 37
  • Thank you for your fast reply, I know about the date format but the issue is that when the user fills out the form they would have to insert it YYYY-MM-DD as that is how MySQL processes it. Do you know of any way I can change this?? – Josh Tumelty Nov 18 '16 at 19:45
  • @JoshTumelty That's the magic of it! The user fills it out in their country-specific format, BUT: the data that is sent to php is always formatted in YYYY-MM-DD already. See for yourself: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_date – Dellowar Nov 18 '16 at 19:47
  • Not all browsers support the `date` type and isn't supported by Firefox and a few others. http://caniuse.com/#feat=input-datetime – Funk Forty Niner Nov 18 '16 at 19:53
  • @Fred-ii- Unfortunately so. Even android and apple browsers support it, it's amazing how Mozilla and Microsoft don't understand the difference between bleeding edge and absolutely necessary. – Dellowar Nov 18 '16 at 20:05
  • @SanchkeDellowar I know and you figure that they would, especially in this day and age. I made an edit to your answer; hope you don't mind. It was added for clarification. – Funk Forty Niner Nov 18 '16 at 20:10