Jump to content

Get the result of the formula and insert it into the field


Recommended Posts

Hi @Gigigigi,

 

You can do this using the following script:

 

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {
 var date = new Date();
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);


function getFormattedDate(date) {
  var year = date.getFullYear();

  var month = (1 + date.getMonth()).toString();
  month = month.length > 1 ? month : '0' + month;

  var day = date.getDate().toString();
  day = day.length > 1 ? day : '0' + day;
  
  return month + '/' + day + '/' + year;
}

var datesearch = document.querySelector("#Value3_1");

datesearch.value = getFormattedDate(lastDay);


});
</script>

 

Make sure to change the Value3_1 in document.querySelector("#Value3_1") with the id of the text field that you want to add the date to.

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.

Guest
Reply to this topic...

×   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.

Loading...
 Share

×
×
  • Create New...