Difference between revisions of "Changing the Default End Date"

From SmartWiki
Jump to: navigation, search
 
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
By default within the Universal Tracking Application the end date for a level 1 item is set to the start data.  In many circumstances you may wish to control the level 1 end date.  The following technique can be used:
+
By default within the [[Universal Tracking Application]] the end date for a level 1 item is set to the start date.  In many circumstances you may wish to control the level 1 end date.   
 
   
 
   
1. Add a new custom field to the UTA custom field list.
+
'''The following technique can be used for UTA level 1:'''
2. Set the field type to Special - Browser Script.
+
 
 +
1. Add a new [[Custom Field|custom field]] to the [[UTA]] custom field list.
 +
 
 +
2. Set the field type to [[Custom Field Type: Special – Browser Script|Special - Browser Script]].
 
   
 
   
 
This field type is not displayed on the page but the script associated with the field will be added to the webpage and the script can be called and executed.
 
This field type is not displayed on the page but the script associated with the field will be added to the webpage and the script can be called and executed.
Line 8: Line 11:
 
3. Add the following Java script to the JavaScript window.
 
3. Add the following Java script to the JavaScript window.
  
function changeEndDate() {
+
  function changeEndDate() {
  var frm=document.form1;
+
    var frm=document.form1;
  if (frm.opportunityid.value==0)
+
    if (frm.opportunityid.value==0)
    frm.enddate.value=''
+
      frm.enddate.value='''''''
  }
+
    }
  changeEndDate();
+
    changeEndDate();
  
  
* This function looks at the opportunityid value which is set to 0 for a level 1 entity before it is saved.  
+
* This function looks at the opportunityid value which is set to 0 for a [[Level 1 Entity]] before it is saved.  
* If the level 1 entity is new (value == 0) then the end date value is set to blank.  
+
* If the [[Level 1 Entity]] is new (value == 0) then the end date value is set to blank.  
 
* The function is called in the last line of the script.  
 
* The function is called in the last line of the script.  
 
* You could also use this approach to set the end date to say the start date + 60 days or set other field values.
 
* You could also use this approach to set the end date to say the start date + 60 days or set other field values.
 +
 +
 +
'''For UTA level 2, use this code to blank the Start date:'''
 +
 +
<pre>
 +
 +
function changeStartDate() {
 +
 +
  var frm=document.frmevent;
 +
 +
  if (frm.eventid.value==0)
 +
 +
    frm.startdate.value=''
 +
 +
    }
 +
 +
    changeStartDate();
 +
 +
</pre>
 +
 +
'''For UTA level 3, use this code to blank the end date:'''
 +
 +
<pre>
 +
 +
function changeEndDate() {
 +
 +
  var frm=document.frmevent;
 +
 +
  if (frm.eventid.value==0)
 +
 +
    frm.enddate.value=''
 +
 +
    }
 +
 +
    changeEndDate();
 +
 +
</pre>
 +
 +
[[Category:Universal Tracking Application]][[Category:Applications]][[Category:JavaScript]][[Category:Date Formats]]

Latest revision as of 14:05, 24 June 2013

By default within the Universal Tracking Application the end date for a level 1 item is set to the start date. In many circumstances you may wish to control the level 1 end date.

The following technique can be used for UTA level 1:

1. Add a new custom field to the UTA custom field list.

2. Set the field type to Special - Browser Script.

This field type is not displayed on the page but the script associated with the field will be added to the webpage and the script can be called and executed.

3. Add the following Java script to the JavaScript window.

 function changeEndDate() {
   var frm=document.form1;
   if (frm.opportunityid.value==0)
     frm.enddate.value=''
    }
    changeEndDate();


  • This function looks at the opportunityid value which is set to 0 for a Level 1 Entity before it is saved.
  • If the Level 1 Entity is new (value == 0) then the end date value is set to blank.
  • The function is called in the last line of the script.
  • You could also use this approach to set the end date to say the start date + 60 days or set other field values.


For UTA level 2, use this code to blank the Start date:


function changeStartDate() {

   var frm=document.frmevent;

   if (frm.eventid.value==0)

     frm.startdate.value=''

    }

    changeStartDate();

 

For UTA level 3, use this code to blank the end date:


function changeEndDate() {

   var frm=document.frmevent;

   if (frm.eventid.value==0)

     frm.enddate.value=''

    }

    changeEndDate();