locked
To fire a javascript on change in the dropdown value in NewForm.aspx in sharepoint2010 RRS feed

  • Question

  • I am working on Sharepoint 2010.

    I am using Sharepoint calender to  book an event.

    There are dropdowns for Start Time and end Time.

    I want to fire javascript on the Change of both dropdowns.

    How to fire a javascript on change in the dropdown value in NewForm.aspx?

    Thursday, August 29, 2013 12:07 PM

Answers

  • Hi,

    From your description, you want to fire javascript when the value of DateTime Picker changes.

    We can override the OnPickerFinish function in DatePicker.js to fire the event when the date is updated from the date picker like this:

    function OnPickerFinish(resultfield)
    {
        clickDatePicker(null,"","");
    
        //your code here
    
        alert(resultfield.value);
    
    }

    This link will show how to override the OnPickerFinish function:

    http://theway4ward.wordpress.com/2013/07/30/211/

    Before coding, a jQuery Library for SharePoint Web Services needs to be downloaded, then we can upload this jQuery Library to a SharePoint document library and reference it at the head of the script like this:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    
    <script type="text/javascript" src="http://yoursite/yourdocumentlibrary/jquery.SPServices-2013.01.min.js"></script>

    The jquery.SPServices-2013.01.min.js can be downloaded from:

    http://spservices.codeplex.com/SourceControl/latest

    Feel free to reply if you have any questions.

    best regards

    Friday, August 30, 2013 5:53 AM