Subscribe to Subscribers

Resources » Code Snippets » Active Directory

Calculating a date field based upon the selection of a picklist


Posted Date:     Category: Active Directory    
Author: Member Level: Gold    Points: 10



Calculating a date field based upon the selection of a picklist

The following script assumes that you have a picklist with three values: "1 year", "2 years" and "3 years".


var years = 0;
switch(crmForm.all..DataValue) {
//You need to check the picklist values if they have the values 1, 2 and 3. Look at the attribute in the entity customization and note the option values.
case "1":
years = 1;
break;
case "2":
years = 2;
break;
case "3":
years = 3;
break; }
if (years != 0) {
var date = new Date();
date.setYear(date.getYear() + years);
crmForm.all..DataValue = date; }





Did you like this resource? Share it with your friends and show your love!


Responses to "Calculating a date field based upon the selection of a picklist"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Getting notified when the user selects a another tab on a form
    Previous Resource: Creating a new email when double-clicking a standard text field
    Return to Resources
    Post New Resource
    Category: Active Directory


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Selection of a picklist  .  Date field  .  

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.