SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic text-field

    Hello

    I have two textfield and dropdown, i want add date to the first textfield and when change dropdown menu add year or month dynamically to the second text-field
    any help?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You need JavaScript for that. Try googling for 'AJAX'.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know but how?

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i used this code but it give me
    NaN/NaN/NaN

    Code:
    function calDate() {
    var dateArr = document.getElementById('date_field1').value;
    var date1 = new Date();
    date1.setFullYear(dateArr[2],dateArr[1]-1,dateArr[0]);
    date1.setDate(date1.getDate()+5);
    document.getElementById("date_field2").value = date1.getDate() + "/" + (date1.getMonth()+1) + "/" + date1.getFullYear();


Bookmarks

Posting Permissions

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