Default Date field on a web form

Default Date field on a web form

Hi,

I have a hidden field on a form which is a date field, I want the field to default to the date the form is submitted.  This isn't a build in function so I have created a rule that should set the field when the record is created but this doesn't work (only works for UI created records)

I have seen some share a script to add into the HTML code but this too doesn't work (see below)

<script>
var ct = new Date();
var curmonth = ct.getMonth() + 1
var curday = ct.getDate()
var curyear = ct.getFullYear()
document.getElementById("Application Date").value = curday + "/" + curmonth + "/" + curyear;
</script>

Has anyone managed to get similar to work please?