• dinesh jain
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I want to create a popup window on dblclick of an element and take some input through input fields. What JavaScript or JQuery should I use for this.

 

I am using code like following:-

 

$("p").bind('dblclick', function(){
        if (!sfdcPage.editMode)
        sfdcPage.activateInlineEditMode();

        if (!sfdcPage.inlineEditData.isCurrentField(sfdcPage.getFieldById(elementID)))
        sfdcPage.inlineEditData.openField(sfdcPage.getFieldById(elementID));
    });

 

 

But I'm not getting the methods of sfdcPage...plz help me

trigger restrictHindiTeacher on Contact (before Insert, before Update) {
    List<Contact> conNewList = trigger.new;
    List<Contact> conOldList = trigger.old;
   
        if(conNewList[0].subjects__c == 'hindi'){
            conNewList[0].addError('Teacher REstricted');        
        }else if(conOldList[0].subjects__c == 'hindi'){
            conOldList[0].addError('Teacher REstricted');        
        }
}

 

This code is working when I add subject hindi to picklist but doesn't work when remove hindi from piicklist.

Means is working while trigger.new but not while trigger.old

//Class for Calculating Working Dates between Two Days
public with sharing class TotalWorkingDyasBetweenTwoDates {
     public static Double totalWorkingDays(Date startDate,Date endDate){
        Double totalWorkingDays = 0;
        Double temps; 
        Date tempDate = date.newInstance(1985, 6, 24); 
        //Calculating mod of no of days between random date and start date
        Double temp = Math.mod(tempDate.daysBetween(startDate) , 7);
        if(temp==0){
             System.debug('hello 0');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 2;
            }
            else if(temps == 2 ){
                totalWorkingDays = 3;
            }
            else if(temps == 3 ){
                totalWorkingDays = 4;
            }
            else if(temps == 4 ){
                totalWorkingDays = 5;
            }
            else if(temps == 5 ){
                totalWorkingDays = 5;
            }
            else if(temps == 6 ){
                totalWorkingDays = 5;
            }
            else
                totalWorkingDays = 1;
        }
       else if(temp==1){
                    System.debug('hello 1');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 2 ){
                totalWorkingDays = 3;
            }
            else if(temps == 3 ){
                totalWorkingDays = 4;
            }
           else  if(temps == 4 ){
                totalWorkingDays = 5;
            }
            else if(temps == 5 ){
                totalWorkingDays = 4;
            }
            else if(temps == 6 ){
                totalWorkingDays = 5;
            }
            else
                totalWorkingDays = 1;
            
        } 
       else if(temp==2){
                    System.debug('hello 2');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 2 ){
                totalWorkingDays = 3;
            }
           else if(temps == 3 ){
                totalWorkingDays = 3;
            }
           else  if(temps == 4 ){
                totalWorkingDays = 3;
            }
           else  if(temps == 5 ){
                totalWorkingDays = 4;
            }
           else  if(temps == 6 ){
                totalWorkingDays = 5;
            }
            else
                totalWorkingDays = 1;
            
        } 
       else if(temp==3){
                    System.debug('hello 3');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 2 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 3 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 4 ){
                totalWorkingDays = 3;
            }
           else  if(temps == 5 ){
                totalWorkingDays = 4;
            }
           else  if(temps == 6 ){
                totalWorkingDays = 5;
            }
            else
                totalWorkingDays = 1;
           
        } 
       else if(temp==4){
                    System.debug('hello 4');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 1;
            }
           else  if(temps == 2 ){
                totalWorkingDays = 1;
            }
           else  if(temps == 3 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 4 ){
                totalWorkingDays = 3;
            }
           else  if(temps == 5 ){
                totalWorkingDays = 4;
            }
           else  if(temps == 6 ){
                totalWorkingDays = 5;
            }  
            else
                totalWorkingDays = 1;          
        } 
        else if(temp==5){
                     System.debug('hello 5');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 0;
            }
           else  if(temps == 2 ){
                totalWorkingDays = 1;
            }
           else  if(temps == 3 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 4 ){
                totalWorkingDays = 3;
            }
           else  if(temps == 5 ){
                totalWorkingDays = 4;
            }
            else if(temps == 6 ){
                totalWorkingDays = 5;
            }
            else
                totalWorkingDays = 0;
            
        } 
       else if(temp==6){
                    System.debug('hello 6');
            temps =  Math.mod(startDate.daysBetween(endDate) , 7);
            if(temps == 1 ){
                totalWorkingDays = 1;
            }
           else  if(temps == 2 ){
                totalWorkingDays = 2;
            }
           else  if(temps == 3 ){
                totalWorkingDays = 3;
            }
           else  if(temps == 4 ){
                totalWorkingDays = 4;
            }
          else   if(temps == 5 ){
                totalWorkingDays = 5;
            }
            else if(temps == 6 ){
                totalWorkingDays = 5;
            }
            else
                totalWorkingDays = 0; 
        } 
        else{
                System.debug('sffsf');
                totalWorkingDays = 999;
        }
       
        totalWorkingDays = totalWorkingDays + math.floor(startDate.daysBetween(endDate)/7*5);  
        return totalWorkingDays;
    }
 }