I use a registration form from Ultimate Member plugin, in which each user gives his birthday. The field is saved as d/m/Y (ex. 17/11/1995) with a metakey named "birthday" in usermeta table. After this registration, each user can sumbit other forms in my site (which i create manually with html). In these forms i use autofill mode from the registration data by using:
value="<?php echo um_user('birthday');?>"
So with this way, if someone has already provided the data that the form needs in his registration, it is already written in the appropriate field.
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" value="<?php echo um_user('birthday');?>" name="birthday" required>
The problem is that the date is not filled with the data provided in registration, although other data types do normally. I tried to solve this by using type="datetype"
and it works, but i cant control the input with this type.
Any ideas? (I prefer solutions with php or html because im not familiar with Javascript).
Thanks in advance!
CodePudding user response:
I think you need to format the date for the value attribute to be accepted. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date "value: A DOMString representing a date in YYYY-MM-DD format, or empty"