Skip to main content
Participant
November 9, 2018
Question

Form Field Calendar Date Issue

  • November 9, 2018
  • 1 reply
  • 497 views

Hi, I’ve created a form which contains several date fields, which all seemed to work just fine until recently.

I’d entered the following code to ‘reset’ the date so the current calendar pop-up would not select the date used in a previous date field:

if (this.getField("DMSignedDate").value =="")

{this.getField("DMSignedDate ").value = new Date();}

Now I see an error ‘Invalid date/time: please ensure that the date/time exists. Field [Field_name] should match format dd-mmm-yyyy.’

The field does match the format and worked up until the UK clock changed from British Summer time (1 Hour adjustment). Thanks for any help & guidance

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 9, 2018

Try this code, instead:

if (this.getField("DMSignedDate").value == "") {

    this.getField("DMSignedDate ").value = util.printd("dd-mmm-yyyy", new Date());

}

ngc2215Author
Participant
November 9, 2018

thank try67, that fixed the error issue, but applies the current date automatically. Is it possible to set the calendar so no date is selected by default?

Thanks Noekl

try67
Community Expert
Community Expert
November 9, 2018

I don't think so. If the field is empty it will select the current date by default, I believe.