Order date

I would like to add an order date to my order form. Would it be possible for today’s date to appear automatically without having to select the date?

Link to the page with the widget in question:

Dominik

2 Likes

Yep, it’s possible!

To implement it, I’ve added to your widget a Hidden field Order Date:

And this code was placed in the Custom JS field on the Settings tab of your widget’s settings:

widget.setFieldValue("[order-date]", new Date().toString());


Please test it out and let me know how it works :slightly_smiling_face:

1 Like

I’m probably doing something wrong:

My result:

1 Like

This feature will work only when testing from the website, where the widget is installed. Could you please try to send the submission from your website and let me know if it worked?

It works, but can it also be displayed like this (in German)?

1 Like

Sure! I’ve replaced the previous JS script with the new one:

widget.setFieldValue("[order-date]", new Date().toLocaleString('de-DE', {
  weekday: 'long',
  year: 'numeric',
  month: 'long',
  day: 'numeric',
  hour: '2-digit',
  minute: '2-digit',
  second: '2-digit',
  timeZoneName: 'short'
}));

Please check it out and let me know how it works :slightly_smiling_face:

1 Like

Unfortunately, it no longer works that way.

1 Like

Oh, apologies, there was a wrong field id in the code. I’ve adjusted it and everything should be working fine now :slightly_smiling_face:

Perfect. Thank you very much!! :slight_smile:

Is it also possible that the unfilled fields are not sent?

1 Like

Great Solution. :clap:
I can use that too.

2 Likes

Unfortunately, it’s impossible to do this now. I see that you’ve already created a request for this feature - Send only filled fields from form builder.

If any news comes up, we’ll update you in your request thread :slightly_smiling_face: