Jump to content
  • 0

Write result of calculation into a field


nestorwagner
 Share

Question

Hi everyone,

I have two date fields -- reg and deadline. I want to store in the deadline field the following: reg + 7 days.

Does anyone know the java script to be inserted in the submission form (in the footer)?

In the alternative, does anyone know the script to write in the deadline field the following: today() + 7 days

Thank you!!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

refer to this post:http://forums.caspio.com/viewtopic.php?f=3&t=14334

In your case you can change it to:

function f_date(){

var v_currentDate=new Date();

v_currentDate.setDate(v_currentDate.getDate() +7);

var v_assignDate = (v_currentDate.getMonth() + 1) + "/" + v_currentDate.getDate() + "/" + (v_currentDate.getFullYear());

alert(v_assignDate);

document.getElementsByName('ID')[0].value = v_assignDate;

}

f_date();

Change the ID with your field ID where you want to save your deadline date. If you cannot get the ID give me the link to help you on that

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

Loading...
 Share

×
×
  • Create New...