The Case of the Jumping Cursor

  • 1
  • Problem
  • Updated 7 months ago
  • In Progress
Hello! After an upgrade from 8.15.15 to 10.0.21 we have a user on an iPad reporting the Case of the Jumping Cursor.

The blinking cursor apparently does not settle in the box that the user taps on. It likes to jump all over the page (even hovering between text fields). And as the user types, the words appear in places other than the position of the cursor or the box that was tapped on.

Here's the case in the user's own words, and an attempt at a screenshot.

If you look at the cursor [in the screenshot below, circled in red] it is down below half in the last name box, however, it was typing in the first name box where “Sarah” is written. Next, I tried to click on the last name text box to enter “Smith” and while it [the cursor] appeared to be in the correct text box, it actually typed above in the notes box. So, the last name Smith is up above even though it looks like it should be typing in the correct spot. 


We are using a custom theme based on the Modern theme. All themes are up to date after the upgrade.

Thoughts? Ideas?

One other user experienced a similar jumping cursor issue on a touchscreen chromebook, however the issue resolved with a simple refresh. The user reporting the case above is consistently experiencing the problem.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 7 months ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Do you have any custom javascript on this page? 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
yes, quite a bit. Too much to paste here. 

I think this is the only resource that's unique to this page, though:

// Custom Scheduling Form Renderers
(function (skuid){
//////////////////////////////////////////////
// Shortcuts, Variables & Functions //
//////////////////////////////////////////////
var $ = skuid.$,
$s = skuid.snippet.getSnippet,
SCH_defaults;
var getSCH_Defaults = function(){
var model = skuid.$M('SchedulingCustom_Defaults') || skuid.$M('Defaults');
return model && model.getFirstRow();
};
var customRenderers = {
'Additional_Staff_Role__c': 'renderStaffRoles',
'Alternate_Phone_Type__c': 'renderPhoneTypes',
'Appointment_Type__c': 'renderAppointmentTypes',
'Caller_Primary_Phone_Type__c': 'renderPhoneTypes',
'Case_Type__c': 'renderCaseTypes',
'Default_State__c': 'renderState',
'Father_of_the_Baby_Intention__c': 'renderPregnancyIntentions',
'Interaction_Intention__c': 'renderPregnancyIntentions',
'Interaction_Purpose__c': 'interactionPurposeFork',
'Lead_Case_Type__c': 'renderCaseTypes',
'Mailing_Address_State__c': 'renderState',
'Physical_Address_State__c': 'renderState',
'Pregnancy_Intention__c': 'renderPregnancyIntentions',
'Pregnancy_Intention_on_Intake__c': 'renderPregnancyIntentions',
'Preliminary_AVR__c': 'renderPreliminaryAVR',
'Primary_Phone_Type__c': 'renderPhoneTypes',
'Primary_Staff_Role__c': 'renderStaffRoles',
'Referral_Source__c': 'renderReferralSources',
'Results__c': 'renderPregnancyTestResults',
'Role__c': 'renderStaffRoles',
'Sexual_Exposure_to_What_STD__c': 'renderSTDs',
'State__c': 'renderState',
'STD__c': 'renderSTDs',
'STD_Picklist': 'renderSTDs',
'UPT_Results__c': 'renderPregnancyTestResults',
'Records_to_Release__c': 'renderRecordsToRelease',
'Return_Appointment_Details__c': 'renderReturnAppointmentDetails',
'Support_for_Continuing_Pregnancy__c': 'renderSupports',
'Support_for_Termination__c': 'renderSupports'
};
var onFunction = function(field,value){
if (customRenderers[field.id]) {
$s(customRenderers[field.id])(field,value);
} else {
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
}
},
offFunction = function(field,value){
field.wrapperElement.hide();
},
requiredFunction = function(field,value){
field.required = true;
field.element.addClass('required');
if (customRenderers[field.id]) {
$s(customRenderers[field.id])(field,value);
} else {
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
}
};
var renderActions = {
'On': onFunction,
'Off': offFunction,
'Required': requiredFunction
};
//////////////////////////////////////////////
// Snippets //
//////////////////////////////////////////////
var snippets = {
renderSCH : function(field,value){
value = skuid.utils.decodeHTML(value);
if (!SCH_defaults) SCH_defaults = getSCH_Defaults();
var action = SCH_defaults['SCH_'+field.id] || 'On';
renderActions[action](field,value);
},
refreshPreview : function(){
SCH_defaults = getSCH_Defaults();
skuid.$C('scheduling_preview').render();
},
checkBeenBefore : function(){
var row = arguments[0].row;
return row && row.Have_you_been_before__c;
}
};
//////////////////////////////////////////////
// Register Snippets //
//////////////////////////////////////////////
$.each(snippets,function(name,func){ skuid.snippet.registerSnippet(name,func); });

})(skuid);
The 'custom renderers; section refers to this resource, which is on the master page:
// Custom Picklist Rendering Javascript
(function (skuid){
/*
 * NOTE:
 * If changes are made to the required (permanant) or stock values of a picklist,
 * or if a new picklist is added, the explanation section of the 
 * Custom Picklists skuid page must be updated.
 */
//////////////////////////////////////////////
// Shortcuts & Global Variables //
//////////////////////////////////////////////
var $ = skuid.$,
$v = skuid.utils.decodeHTML,
$s = skuid.snippet.getSnippet,
picklistRows;
//////////////////////////////////////////////
//    Helper Functions //
//////////////////////////////////////////////
var 
getPicklistRows = function(){
var picklistModel = skuid.$M('CustomPicklists');
picklistRows = picklistModel.getRows();
},
mergeLists = function(required,custom,stock){
// Include either custom or stock, if they have entries; automatically include required if it has entires
var listArray = ((required.length && required) || []).concat((custom.length && custom) || (stock.length && stock) || []);
//Remove Duplicates
var dedup = {}, mergedArray = [];
for (var i=0, l=listArray.length; i<l; i++){
dedup[listArray[i].Picklist_Value__c] = listArray[i];
}
for (var key in dedup){
mergedArray.push(dedup[key]);
}
return mergedArray;
},
getDefaultRow = function(){
var model = skuid.$M('DefaultCenter') || skuid.$M('RegistrationDefaults');
return model && model.getFirstRow();
};
//////////////////////////////////////////////
// Snippets //
//////////////////////////////////////////////
var snippets = {
//Picklist Renderers
'renderCaseTypes': function (field, value) {
value = $v(value);
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Pregnancy'}
];
//Add STD and Abortion Pill Reversal if indicated in Defaults
    var defaultsRow = getDefaultRow();
    if (defaultsRow && defaultsRow.Full_Panel_STD_Cases__c) required.push(
    {Picklist_Value__c: 'STD'}
    );
    if (defaultsRow && defaultsRow.Provide_Abortion_Pill_Reversal__c) required.push(
    {Picklist_Value__c: 'Pill Reversal'}
    );
    var stock = [];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Case Types';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
        
    });
    field.metadata.picklistEntries = picklistEntries;
    if (field.metadata.displaytype === 'MULTIPICKLIST') {
    if (field.mode === 'edit') {
oMultipickEdit.apply(this,arguments);
} else  {
multipickRenderers[field.mode](field,value);
}
    } else {
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
    }
},
'renderPhoneTypes': function (field, value) {
value = $v(value);
if (!picklistRows) getPicklistRows();
var required = [];
var stock = [
{Picklist_Value__c: 'Call & Text', Default__c: true},
{Picklist_Value__c: 'Call only', Default__c: false},
{Picklist_Value__c: 'Text only', Default__c: false}
];
var filteredList = (picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Phone Types';
})) || stock;
    var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    //Check if this is primary phone type for patient, and add "Caller other than patient"
    var enableCallerRow = skuid.$M('DefaultCenter') && skuid.$M('DefaultCenter').getFirstRow(),
    ifCondition = !skuid.page.name.startsWith('Registration') &&
    ((field.model.label === "Patient") || (field.model.label === "Open Appointment")) &&
      (field.id === "Primary_Phone_Type__c") &&
      !(enableCallerRow && enableCallerRow.SCH_Disable_Caller_Other_Than_Patient__c);
    if (ifCondition) {
    picklistEntries.push(
    { value: 'Caller other than patient', label: 'Caller other than patient', defaultValue: false, active: true }
    );
    }
    field.metadata.picklistEntries = picklistEntries;
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderPreliminaryAVR': function (field, value) {
value = $v(value);
if (!value) {
//Get default value
var defaultsRow = getDefaultRow();
value = defaultsRow && defaultsRow.Default_Preliminary_AVR__c;
//Update model with default value
if (value) field.model.updateRow(field.row,field.id,value,{initiatorId: field._GUID});
}
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderPregnancyIntentions': function (field, value) {
value = $v(value);
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Abort'}
];
var stock = [
{Picklist_Value__c: 'Continue pregnancy parent'},
{Picklist_Value__c: 'Continue pregnancy adopt'},
{Picklist_Value__c: 'Continue pregnancy undecided'},
{Picklist_Value__c: 'Undecided'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Pregnancy Intentions';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    //Father of the Baby Intention alterations
    if (field.id === 'Father_of_the_Baby_Intention__c') {
        //Remove Not Pregnancy
        for (var i = picklistEntries.length - 1, notPregIndex = -1; (notPregIndex === -1) && (i >= 0); i--) {
        if(picklistEntries[i].value === 'Not Pregnant') notPregIndex = i;
        }
        if (notPregIndex > -1) picklistEntries.splice(notPregIndex,1);
    //Add supports my choice
    picklistEntries.push(
        { value: 'Supports my choice', label: 'Supports my choice', defaultValue: false, active: true }
        );
    }
    field.metadata.picklistEntries = picklistEntries;
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderStaffRoles': function (field, value) {
value = $v(value);
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Scheduler'},
{Picklist_Value__c: 'Advocate'},
{Picklist_Value__c: 'Nurse'},
{Picklist_Value__c: 'Medical Director'}
];
var stock = [
{Picklist_Value__c: 'Executive'},
{Picklist_Value__c: 'Receptionist'},
{Picklist_Value__c: 'Follow-up Specialist'},
{Picklist_Value__c: 'Sonographer'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Staff Roles';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
if (field.metadata.displaytype === 'MULTIPICKLIST') {
    if (field.mode === 'edit') {
oMultipickEdit.apply(this,arguments);
} else  {
multipickRenderers[field.mode](field,value);
}
    } else {
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
    }
},
'renderSTDs': function (field, value) {
value = $v(value);
//Do not run custom renderer for the STD__c field on the Patient_STD__c object
if (field.model.objectName !== 'Patient_STD__c') {
if (!picklistRows) getPicklistRows();
var required = [];
var stock = [
{Picklist_Value__c: 'Gonorrhea'},
{Picklist_Value__c: 'Chlamydia'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'STDs';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
}
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderAppointmentTypes': function (field,value){
value = $v(value);
// Skuid uses a different, internal system for getting the picklist entries with dependent picklists,
// and Interaction_Purpose__c is dependent on Interaction_Category__c, 
// We have to approach this one differently.
//Only run custom renderer for non-interactions or interactions where Category is Appointment
if (field.mode === 'edit') {
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Initial Pregnancy Appointment'},
{Picklist_Value__c: 'Return Pregnancy Appointment'}
];
var stock = [];
//Require additional appointment types based on default options
var defaultsRow = getDefaultRow();
if (defaultsRow && defaultsRow.Full_Panel_STD_Cases__c) {
required.push(
{Picklist_Value__c: 'Initial STD Appointment'},
{Picklist_Value__c: 'Return STD Appointment'}
);
} else {
stock.push(
{Picklist_Value__c: 'Return STD Appointment'}
);
}
if (defaultsRow && defaultsRow.Provide_Abortion_Pill_Reversal__c) required.push(
{Picklist_Value__c: 'Initial Pill Reversal Appointment'},
{Picklist_Value__c: 'Return Pill Reversal Appointment'}
);
if (defaultsRow && defaultsRow.Education_Program__c) required.push(
{Picklist_Value__c: 'Education Session'}
);
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Appointment Types';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    //Create new custom select renderer
    var customSelect = skuid.ui.renderers.PICKLIST.edit({
                entries : picklistEntries,
                required : false,
                value : value
            }).change(function() {
                //  Update the row in the target object
                field.model.updateRow(field.row, field.id, $(this).val(), {initiatorId: field._GUID});
            });
    field.element.append(customSelect); 
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderFollowupTypes': function(field,value) {
value = $v(value);
// Skuid uses a different, internal system for getting the picklist entries with dependent picklists,
// and Interaction_Purpose__c is dependent on Interaction_Category__c, 
// We have to approach this one differently.
if (field.mode === 'edit') {
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Immediate follow-up'},
{Picklist_Value__c: 'Negative test follow-up'},
{Picklist_Value__c: 'Pregnancy confirmation'},
{Picklist_Value__c: 'Medical follow-up'},
{Picklist_Value__c: '2 week follow-up'},
{Picklist_Value__c: '4 week follow-up'},
{Picklist_Value__c: '8 week follow-up'},
{Picklist_Value__c: '16 week follow-up'},
{Picklist_Value__c: 'After due-date follow-up'},
{Picklist_Value__c: 'Medical chart closing'},
{Picklist_Value__c: 'Chart closing'}
];
var stock = [];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Followup Types';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    //Create new custom select renderer
    var customSelect = skuid.ui.renderers.PICKLIST.edit({
                entries : picklistEntries,
                required : false,
                value : value
            }).change(function() {
                //  Update the row in the target object
                field.model.updateRow(field.row, field.id, $(this).val(), {initiatorId: field._GUID});
            });
    field.element.append(customSelect); 
} else  {
picklistRenderers[field.mode](field,value);
}
},
'interactionPurposeFork': function (field,value) {
value = $v(value);
var cat = field.row.Interaction_Category__c,
fork = {
'Appointment' : $s('renderAppointmentTypes'),
'Follow-up' : $s('renderFollowupTypes')
};
if (fork[cat]) {
fork[cat](field,value);
} else {
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
}
},
'renderPregnancyTestResults': function (field, value) {
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Positive'}
];
var stock = [
{Picklist_Value__c: 'Negative'},
{Picklist_Value__c: 'Inconclusive'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Pregnancy Test Results';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderReturnAppointmentDetails': function (field, value) {
value = $v(value);
if (!picklistRows) getPicklistRows();
var required = [];
var stock = [
{Picklist_Value__c: 'Repeat Pregnancy Test'},
{Picklist_Value__c: 'Repeat Ultrasound'},
{Picklist_Value__c: 'STD Results'},
{Picklist_Value__c: 'Test of Cure'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Return Appointment Details';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
if (field.mode === 'edit') {
oMultipickEdit.apply(this,arguments);
} else  {
multipickRenderers[field.mode](field,value);
}
},
'renderRecordsToRelease': function (field, value) {
value = $v(value);
if (!picklistRows) getPicklistRows();
var required = [];
var stock = [
{Picklist_Value__c: 'All medical records'},
{Picklist_Value__c: 'Urine pregnancy test results'},
{Picklist_Value__c: 'Ultrasound Exam Report'},
{Picklist_Value__c: 'Tests performed'},
{Picklist_Value__c: 'Treatment record'},
{Picklist_Value__c: 'HIV Information'},
{Picklist_Value__c: 'Other'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Records to Release';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
if (field.mode === 'edit') {
oMultipickEdit.apply(this,arguments);
} else  {
multipickRenderers[field.mode](field,value);
}
},
'renderReferralSources': function (field, value) {
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Previous Visit (Patient)'}
];
var stock = [
{Picklist_Value__c: 'Unknown'},
{Picklist_Value__c: 'Friend / Family'},
{Picklist_Value__c: 'Online'},
{Picklist_Value__c: 'Agency'},
{Picklist_Value__c: 'College'},
{Picklist_Value__c: 'Television'},
{Picklist_Value__c: 'Radio'},
{Picklist_Value__c: 'Transit Ads'},
{Picklist_Value__c: 'Billboard'},
{Picklist_Value__c: 'Phonebook'},
{Picklist_Value__c: 'Online Booking'},
{Picklist_Value__c: 'Other'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Referral Sources';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
    if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
},
'renderSupports': function (field, value) {
if (!picklistRows) getPicklistRows();
var required = [
{Picklist_Value__c: 'Other'}
];
var stock = [
{Picklist_Value__c: 'Family'},
{Picklist_Value__c: 'Father of baby'},
{Picklist_Value__c: 'Father'},
{Picklist_Value__c: 'Mother'},
{Picklist_Value__c: 'Brother'},
{Picklist_Value__c: 'Sister'},
{Picklist_Value__c: 'Cousin'},
{Picklist_Value__c: 'Friend'},
{Picklist_Value__c: 'Boyfriend'},
{Picklist_Value__c: 'Husband'},
{Picklist_Value__c: 'Grandparent'},
{Picklist_Value__c: 'No one'}
];
var filteredList = picklistRows && picklistRows.filter(function(row){
return row.Picklist__c === 'Supports';
});
var mergedList = mergeLists(required,filteredList,stock);
    var picklistEntries = [];
    $.each(mergedList,function(i,row){
    if (row.Default__c) {
    picklistEntries.unshift(
    { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: row.Picklist_Value__c, label: row.Picklist_Value__c, defaultValue: false, active: true }
    );
    }
    });
    field.metadata.picklistEntries = picklistEntries;
    if (field.mode === 'edit') {
oMultipickEdit.apply(this,arguments);
} else  {
multipickRenderers[field.mode](field,value);
}
},
'renderState': function (field, value) {
var defaultsRow = getDefaultRow(),
defaultState = defaultsRow && defaultsRow.Default_State__c;
statesList = ['AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FM', 'FL', 'GA', 'GU', 
'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MH', 'MD', 'MA', 'MI', 'MN',
'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'MP', 'OH', 'OK', 
'OR', 'PW', 'PA', 'PR', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VI', 'VA', 'WA', 
'WV', 'WI', 'WY', 'AE', 'AA', 'AP'];
var picklistEntries = [];
$.each(statesList,function(i,state){
if (state === defaultState) {
picklistEntries.unshift(
    { value: state, label: state, defaultValue: true, active: true }
    );
    } else {
    picklistEntries.push(
            { value: state, label: state, defaultValue: false, active: true }
    );
}
});
field.metadata.picklistEntries = picklistEntries;
    if (field.mode === 'edit') {
oPickEdit.apply(this,arguments);
} else  {
picklistRenderers[field.mode](field,value);
}
}
};
//////////////////////////////////////////////
// Register Snippets //
//////////////////////////////////////////////
$.each(snippets,function(name,func){ skuid.snippet.registerSnippet(name,func); });
//////////////////////////////////////////////
// Global Renderers Override //
//////////////////////////////////////////////
/* NOTE: 
 * Any fields added to the global renderers overrides
 * should also be added to the customRenderers object
 * on OptimizeJS_CustomSchedulingForm.js
 */
//Picklists//
// Get references to our original picklist field renderers
var picklistRenderers = skuid.ui.fieldRenderers.PICKLIST; 
var oPickEdit = picklistRenderers.edit;
//Object as switch statement-- stores field API names and corresponding snippet names
var globalPickFields = {
'Additional_Staff_Role__c': 'renderStaffRoles',
'Alternate_Phone_Type__c': 'renderPhoneTypes',
'Appointment_Type__c': 'renderAppointmentTypes',
'Caller_Primary_Phone_Type__c': 'renderPhoneTypes',
'Case_Type__c': 'renderCaseTypes',
'Default_State__c': 'renderState',
'Father_of_the_Baby_Intention__c': 'renderPregnancyIntentions',
'Interaction_Intention__c': 'renderPregnancyIntentions',
'Interaction_Purpose__c': 'interactionPurposeFork',
'Lead_Case_Type__c': 'renderCaseTypes',
'Mailing_Address_State__c': 'renderState',
'Physical_Address_State__c': 'renderState',
'Pregnancy_Intention__c': 'renderPregnancyIntentions',
'Pregnancy_Intention_on_Intake__c': 'renderPregnancyIntentions',
'Preliminary_AVR__c': 'renderPreliminaryAVR',
'Primary_Phone_Type__c': 'renderPhoneTypes',
'Primary_Staff_Role__c': 'renderStaffRoles',
'Referral_Source__c': 'renderReferralSources',
'Results__c': 'renderPregnancyTestResults',
'Role__c': 'renderStaffRoles',
'State__c': 'renderState',
'STD__c': 'renderSTDs',
'STD_Picklist': 'renderSTDs',
'UPT_Results__c': 'renderPregnancyTestResults'
};
// Override Skuid's standard edit Picklist field renderers to call our custom renderer
picklistRenderers.edit = function(field,value){
       // If the field is one of the global picklist fields, run the snippet for it
if (globalPickFields[field.id] && !field.uiOnly){
//Use a custom renderer
$s(globalPickFields[field.id])(field,value);
} else {
//Use the standard renderer
oPickEdit.apply(this,arguments);
  }
   };
//MultiPicklists//
// Get references to our original picklist field renderers
var multipickRenderers = skuid.ui.fieldRenderers.MULTIPICKLIST; 
var oMultipickEdit = multipickRenderers.edit;
//Object as switch statement-- stores field API names and corresponding snippet names
var globalMultipickFields = {
'Patient_Case_Type__c': 'renderCaseTypes',
'Records_to_Release__c': 'renderRecordsToRelease',
'Return_Appointment_Details__c': 'renderReturnAppointmentDetails',
'Support_for_Continuing_Pregnancy__c': 'renderSupports',
'Support_for_Termination__c': 'renderSupports',
'Include_for_Role__c': 'renderStaffRoles'
};
// Override Skuid's standard edit Multiicklist field renderers to call our custom renderer
multipickRenderers.edit = function(field,value){
       // If the field is one of the global multipicklist fields, run the snippet for it
if (globalMultipickFields[field.id] && !field.uiOnly){
//Use a custom renderer
$s(globalMultipickFields[field.id])(field,value);
} else {
//Use the standard renderer
oMultipickEdit.apply(this,arguments);
  }
   };
})(skuid);