Static date field in form when form is opened at later date.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alexio
    New Member
    • Jan 2008
    • 17

    Static date field in form when form is opened at later date.

    I need to enter a date into a text field when form is loaded. However I need this date to be static when the form is opened at a later date.
    I have the text box set to readonly. Will this be sufficient or do I need some type of Update function for when the form is opened again?


    [HTML]<script language="javas cript">

    window.onload = function (){
    var tDay = new Date();
    tMonth = tDay.getMonth() +1;
    tDate = tDay.getDate();
    if ( tMonth < 10) tMonth = "0"+tMonth;
    if ( tDate < 10) tDate = "0"+tDate;
    document.getEle mentById("OBKey __131_1").value = tMonth+"/"+tDate+"/"+tDay.getFullY ear();
    }

    <input type="text" name="OBKey__13 1_1" size="10" maxlength="10" tabindex="1" readonly="reado nly">[/HTML]
    Last edited by gits; Mar 17 '08, 05:22 PM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    with that code you will always set the value of the inputfield to the current date when the page is loaded ... if that is what you want? ... so please explain in more detail what you mean with 'static' und 'later date' ...

    kind regards

    Comment

    • Alexio
      New Member
      • Jan 2008
      • 17

      #3
      When the form is first filled out by user, the current date is enter dynamically into the date textbox. The form is then saved into the database. When user goes back to open form after a few days, I need the original date to be in the text field not the new current date. So I need the original date to be "static".

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        so you have to retrieve the date from the database ... probably the user has to provide some identification or you may use cookies to store some data at the client ... you cannot just do that only with javascript ...

        kind regards

        Comment

        Working...