www.webdeveloper.com
Results 1 to 9 of 9

Thread: Newbie needs help with onchange

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    112

    Newbie needs help with onchange

    I have an input form that has a select dropdown field named Status with with two options (in process & resolved) with the default being in process. When the user changes the Status to resolved I want to populate another text field (Date_Resolved) on the form with today's date. I have tried everything and am getting no where.

    <Script>
    function chgit() {
    var d = Date.Now();
    document.form1.Date_Resolved.value = d;
    }
    </Script>

    <select name="Status" id="Status" onChange="chgit();" >
    <option value="In Process">In Process</option>
    <option value="Resolved">Resolved</option>
    </select>

    <input name="Date_Resolved" type="text" id="Date_Resolved" value="" size="12" />

    I get this error
    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; Media Center PC 6.0; InfoPath.3)
    Timestamp: Wed, 17 Jul 2013 23:54:20 UTC


    Message: Object doesn't support this property or method
    Line: 5
    Char: 3
    Code: 0
    URI: http://localhost/red/Triage_entry_formA.asp

    Any help with how to do this correctly is greatly appreciated.

  2. #2
    Join Date
    Feb 2013
    Posts
    13
    function chgit(){
    var d = new Date();
    $('#Date_Resolved').val(d);
    }

    also id the date field is important you might want to add readonly="readonly"

  3. #3
    Join Date
    Jun 2006
    Posts
    112
    Thanks for your response:

    Didn't work got this response

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; Media Center PC 6.0; InfoPath.3)
    Timestamp: Thu, 18 Jul 2013 01:51:08 UTC


    Message: Object expected
    Line: 6
    Char: 3
    Code: 0
    URI: http://localhost/red/Triage_entry_formA.asp

    Here is my syntax

    <Script>
    function chgit() {
    var d = new Date();
    $('#Date_Resolved').val(d);
    }
    </Script>

  4. #4
    Join Date
    Feb 2013
    Posts
    13
    I made it in jfiddle and it does work. But something is obviously going wrong. Where is line 6 char 3? Can you post more of the page? Maybe something is conflicting

  5. #5
    Join Date
    Jun 2006
    Posts
    112
    Quote Originally Posted by Jptalon View Post
    I made it in jfiddle and it does work. But something is obviously going wrong. Where is line 6 char 3? Can you post more of the page? Maybe something is conflicting
    Using vbscript and classic ASP - don't know what else to send - just a straight entry form - don't have line 6 char 3 - function is before head end

  6. #6
    Join Date
    Feb 2013
    Posts
    13
    try document.getElementById("Date_Resolved").value = d;

  7. #7
    Join Date
    Jun 2006
    Posts
    112
    That Worked Jptalon. Thank you so much!!! Now I just need to format the date as mm/dd/yyyy - any ideas? Thanks again

  8. #8
    Join Date
    Jul 2013
    Posts
    12
    I am also using vbscript and classic ASP for the audition in uk website. The thousands of customers come to my website daily for the form submission and its never irritating me in any case.

  9. #9
    Join Date
    Feb 2013
    Posts
    13
    Glad it worked. The other one i suggested was jquery and that was my bad in a javascript section. Also i see that you got the date sorted out, cool

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



Recent Articles