Jump to content

input type date html5 value

Recommended Posts


I am using the html5 input type date field in an asp page. I have it saving to the database fine, but how do I display the date as a variable when bringing the date back in the same input type tag? I need to bring it back in the same input tag so the date could be updated if the web user needs to change the original date when adding.




Link to post
Share on other sites

Thanks but I have used other pop up calendars to select the date and the value will return from the database when revisiting that page. I am wondering if the new html5 tag shown here (input date)



is only used for input and the value cannot be set from the database?



<input type="date" name="MessageDatehappen" value="<%=MessageDatehappen%>" />

Link to post
Share on other sites

It works fine for me. If I select a date with that and hit submit, the server shows something like this:


Input was received as:




Then if I change the HTML to show this:


<input type="date" name="bday" value="2013-12-18">


and submit the change, it renders the date field with that date selected. I'm testing with Opera.

Link to post
Share on other sites

That's what I showed above, this is what the HTML for that field needs to look like:


<input type="date" name="bday" value="2013-12-18">


I don't know if that field requires yyyy-mm-dd or not, but that code definitely works in the TryIt editor, you can try it yourself. I would suggest that you convert the date that you have to yyyy-mm-dd format and use that.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...