Current Date in Form Field - HTML Troubles

Hi there. I’m trying to get an inserted html form in Foundry to show the current date in a field. I’ve tried all kinds of routes (from plenty of Google searches) - does anyone have a clever solution to be able to do this?

I currently have this but it only seems to work in Safari. Both Firefox and Chrome insert a date picker which is odd?

Current HTML:

function TodayDate(){
let data= new Date();
return data.getFullYear().toString()+’-’ + (data.getMonth()+1).toString()+’-’ + data.getDate().toString()
document.getElementById(‘today’).innerHTML = ‘

Any help gratefully received! Cheers

Not sure what form you are using and whether you can actually put javascript into the form fields. However, this should work in any php page:

<input type=‘date’ id=‘hasta’ value=’<?php echo date('Y-m-d');?>’>

Also, if you use Formloom 4, you can set the datepicker to enter todays date by default.

Thanks - will give that a try…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.