Jump to content

add 14 days to value


Recommended Posts

hi everyone, I have to text fields, the second needs to take its initial value from the user inputted date in the first and add 14 days but generate it on the fly, Has anybody experience with this?

    </tr>
    <tr>
      <td class="KT_th"><label for="intraartapproval">Art Appr. Date</label></td>
      <td><input type="text" name="intraartapproval" id="intraartapproval" value="<?php echo KT_escapeAttribute($row_rsworksorders['intraartapproval']); ?>" size="32" />
        <?php echo $tNGs->displayFieldHint("intraartapproval");?> <?php echo $tNGs->displayFieldError("worksorders", "intraartapproval"); ?></td>
    </tr>
    <tr>
      <td class="KT_th"><label for="intraestimatedinstall">Est. Install</label></td>
      <td><input type="text" name="intraestimatedinstall" id="intraestimatedinstall" value="USER INPUTTED DATE + 14 DAYS" size="32" />
        <?php echo $tNGs->displayFieldHint("intraestimatedinstall");?> <?php echo $tNGs->displayFieldError("worksorders", "intraestimatedinstall"); ?></td>
    </tr>

Link to comment
Share on other sites

@liamloveslearning

 

Are you familiar with JavaScript?

 

 

If so, you should be able to do something like this:

<form name="myForm">
<label for="intraartapproval">Art Appr. Date</label> <input type="text" name="intraartapproval" id="intraartapproval" size="32" onchange="myForm.intraestimatedinstall.value = Number(this.value) + 14;" /><br />
<label for="intraestimatedinstall">Est. Install</label> <input type="text" name="intraestimatedinstall" id="intraestimatedinstall" size="32" />
</form>

 

 

Note that the above code only works with integers. You'll need to modify the code to work with dates. It looks like it may be a little bit of work, but you should be able to use some of the JavaScript functions found here:

http://www.elated.com/articles/working-with-dates/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.