Jump to content
  • 0

First Day of the month



6 answers to this question

Recommended Posts

  • 0

Hi @NeoInJS,


Having the date field default to first day of the month, and have the field be editable at the same time is currently not possible in Submission Forms without JavaScript customization.


Too keep things simple in cases of "editable-default" value , I usually just setup a Virtual Field that is a placeholder of the custom user-input value, then have a Calculated Value for the actual field to be either the "user-input value", or the default value if it is blank.


You may do so by following these instructions:

1.) Create a Virtual Field that will hold the user-input values. (I would suggest creating a not for your users that say "Defaults to first day of the month").

2.) For the actual date/time field, you may set the Form Element to a "Calculated Value", then use the syntax below (For this example, I assumed that you use Virtual 1 as your placeholder):

CASE WHEN DATALENGTH('[@cbParamVirtual1]') > 0

TRY_CONVERT(date, '[@cbParamVirtual1]')

  1 - DatePart(day, '[@cbTimestamp*]'),



Hope this helps.




Link to comment
Share on other sites

  • 0
17 hours ago, NeoInJS said:

Thank @WatashiwaJin. However, I would still like my users to be able to change the field. I want to see that field populated with the First day of the month when the DataPage loads.

Hi @NeoInJS -- if that is the case then I suggest that you follow these steps:

- Add a "Virtual field" that uses "Calculated value" as the form element and paste the formula:

CONVERT(DATETIME, (CAST(Month(SysUTCDateTime()) AS VARCHAR) + "/01/" + CAST(Year(SysUTCDateTime()) AS VARCHAR)), 101)

- You can also hide the Virtual field -> go to the advance option then check "Hide Field:

- Now, we are going to create a script that will get the value form the formula. For us to do that we need to add a "Header and Footer" -> then in the footer paste this code:

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {
  var vrt = document.querySelector('[name*=cbParamVirtual1]');
  var date = document.querySelector('[name*=InsertRecordYOURDATEFIELD]');
  vrt.onchange = function() {
  date.value = this.value.substring(0,9);

- Make sure that you unchecked the "Enable HTML Editor" in the advance tab of the Footer.

- After this process, your date field will get the first day of the month and it still can be editable :)


For more details, check these article:



I hope this helps :) 


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...