Menu

Two instances on one page

Help
psy
2010-12-15
2013-10-08
  • psy

    psy - 2010-12-15

    Hello,

    I understand that this script is a couple of years old now, but it's exactly what I had been looking for. However, the page I'm using it on has 2 date fields. Whenever I try to use this script for the second field, it will only update the first one.

    Is there any way to get the two fields to work independently of each other? Thanks!

     
  • Tony Otter

    Tony Otter - 2013-10-08

    Even more years pass, but I've just used the script to provide two dates to set a date range.

    I used the following HTML:

      <input type="hidden" name="fldName" id="fldName" />
      <input type="button" value="From Date" onclick="javascript:setDateFld('frDate')" />
      <input type="text" name="frDate" id="frDate" />
      <input type="button" value="To Date" onclick="javascript:setDateFld('toDate')" />
      <input type="text" name="toDate" id="toDate" />
    

    Maybe not that elegant, but the following changes to the script.js file work fine.
    All they do is allow a field name to be set.

    function setDateFld(fldName) {
    document.getElementById("fldName").value = fldName;
    viewcalendar();
    }

    function insertdate(d) {
    window.close();
    dateFldName = window.opener.document.getElementById("fldName").value;
    window.opener.document.getElementById(dateFldName).value = d;
    }

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.