Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How to do a calculation based on the selected value of a drop-down list?

$
0
0

Hi Guys,

Can you help me to correct this JQuery code below? This is supposed to be for a SharePoint 2010 list form with a dropdown list named ResponseTime and Single line of text field named DueDateFieldResponseTime has 2 choices namely Normal and Urgent. May we ask guys if we should we replace #dropdown with ResponseTime? Also, as we would like the result date to be inserted on this text field (DueDateField) in the list form, did we code it correctly? Please advise.

$(document).ready(function() {

    $('#dropdown').change(function() {

        dropdown = $('#dropdown').val();

        var CurrentDate = today.getDate();

        var DueDate;

  

        if (dropdown == 'Normal')

        {

           DueDate = CurrentDate + 15 days

           $("DueDateField").val(DueDate);       

        }

 

        else if (dropdown == 'Urgent')

        {

           DueDate = CurrentDate + 7 days

          $("DueDateField").val(DueDate);       

        }

    });

});

Thank You,


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>