Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Date field populates depending on when form opens

stephenf8734174
Level 3
Level 3

Hi - I have a form to be submitted that includes a list of subjects for a particular meeting that happens each Monday. Can a date field populate with the date of that Monday when the form opens in the preceeding week? And then happen each week after that?

Thanks.

1 Accepted Solution
Mark_Lindberg
Correct answer by
Level 5
Level 5

Are you generating a new form each week?

If so, this will get the date for next Monday - you can play with the format:

var d = new Date();

d.setDate(d.getDate() + (1 + 7 - d.getDay()) % 7);

this.rawValue = d;

If you are using the same form for multiple weeks, then you would need to test to see if the current field value was less that the value generated by the script and replace in the field if needed.

Good Luck,

View solution in original post

1 Reply
Mark_Lindberg
Correct answer by
Level 5
Level 5

Are you generating a new form each week?

If so, this will get the date for next Monday - you can play with the format:

var d = new Date();

d.setDate(d.getDate() + (1 + 7 - d.getDay()) % 7);

this.rawValue = d;

If you are using the same form for multiple weeks, then you would need to test to see if the current field value was less that the value generated by the script and replace in the field if needed.

Good Luck,

View solution in original post