Results 1 to 2 of 2

Thread: display one year from first textbox in second textbox

  1. #1
    Join Date
    Jul 2013

    Question display one year from first textbox in second textbox

    I have two textboxes in a form. The first textbox contains a calender. I would like to display after one year date in second text box based on the calender date selected in first text box. How to achieve this? I only know about getting the current textbox value but not how to put after one year date in second textbox.

    PHP Code:
    <td><input type="text" name="soname3" id="id1" size="15"
    img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('id1','MMddyyyy','dropdown',false,'12')" /></td>
    td><input type="text" name="" id="id2" size="20"> </td

  2. #2
    Join Date
    Jul 2013
    I tried the below code, it worked with onblur. But if I use the calender, then the second textbox value doesn't change. How to get it changes automatically once the value from calender is selected.

    function addDays(theField,fName,daysToAdd){
    var theForm = theField.form;
    var fDate = new Date(theField.value);
    var MM = fDate.getMonth()+1;
    var DD = fDate.getDate();
    var YY = fDate.getFullYear();
    if(MM<10) MM="0"+MM;
    if(DD<10) DD="0"+DD;
    theForm[fName].value = MM+"-"+DD+"-"+YY;
    <input type=text id="id1" name="EffectiveDate" value="08-28-2005" size="10" onchange="addDays(this,'90Days',365)">
    <img src="../Image/cal.gif" id="" style="cursor: pointer;" onclick="javascript:NewCssCal('id1','MMddyyyy','dropdown',false,'12')" />

    <input type=text name="90Days" size="10">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center